{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[[0 0]\n",
      "  [0 1]\n",
      "  [0 2]\n",
      "  [0 3]]\n",
      "\n",
      " [[1 0]\n",
      "  [1 1]\n",
      "  [1 2]\n",
      "  [1 3]]\n",
      "\n",
      " [[2 0]\n",
      "  [2 1]\n",
      "  [2 2]\n",
      "  [2 3]]]\n",
      "[[[0 0]\n",
      "  [0 1]\n",
      "  [0 2]\n",
      "  [0 3]]\n",
      "\n",
      " [[1 0]\n",
      "  [1 1]\n",
      "  [1 2]\n",
      "  [1 3]]\n",
      "\n",
      " [[2 0]\n",
      "  [2 1]\n",
      "  [2 2]\n",
      "  [2 3]]]\n"
     ]
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "import torch\n",
    "import numpy as np\n",
    "Hc = 3\n",
    "Wc = 4\n",
    "coord_cells = tf.stack(tf.meshgrid(tf.range(Hc), tf.range(Wc), indexing='ij'), axis=-1)\n",
    "a = tf.Session().run(coord_cells)\n",
    "\n",
    "print(a)\n",
    "\n",
    "import torch\n",
    "coor_cells = torch.stack(torch.meshgrid(torch.arange(Hc), torch.arange(Wc)), dim=2) # [Hc, Wc, 2]\n",
    "b = coor_cells.numpy()\n",
    "\n",
    "print(b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/home/yoyee/Documents/deepSfm\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "import sys\n",
    "module_path = os.path.abspath(os.path.join('..'))\n",
    "if module_path not in sys.path:\n",
    "    sys.path.append(module_path)\n",
    "import matplotlib.pyplot as plt\n",
    "os.chdir('../')\n",
    "print(os.getcwd())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# from utils.utils import warp_points_np\n",
    "def warp_points_np(points, homographies, device='cpu'):\n",
    "    \"\"\"\n",
    "    Warp a list of points with the given homography.\n",
    "\n",
    "    Arguments:\n",
    "        points: list of N points, shape (N, 2).\n",
    "        homography: batched or not (shapes (B, 3, 3) and (...) respectively).\n",
    "\n",
    "    Returns: a Tensor of shape (N, 2) or (B, N, 2) (depending on whether the homography\n",
    "            is batched) containing the new coordinates of the warped points.\n",
    "    \"\"\"\n",
    "    # expand points len to (x, y, 1)\n",
    "    batch_size = homographies.shape[0]\n",
    "    points = np.concatenate((points, np.ones((points.shape[0], 1))), axis=1)\n",
    "    # points = points.to(device)\n",
    "    # homographies = homographies.(batch_size*3,3)\n",
    "    # warped_points = homographies*points\n",
    "    # warped_points = homographies@points.transpose(0,1)\n",
    "    warped_points = np.tensordot(homographies, points.transpose(), axes=([2], [0]))\n",
    "    # normalize the points\n",
    "    warped_points = warped_points.reshape([batch_size, 3, -1])\n",
    "    warped_points = warped_points.transpose([0, 2, 1])\n",
    "    warped_points = warped_points[:, :, :2] / warped_points[:, :, 2:]\n",
    "    return warped_points\n",
    "\n",
    "\n",
    "def plot_points(matrix, ls='--', lw=1.2, colors=None):\n",
    "    x_points, y_points = matrix[:,0], matrix[:,1]\n",
    "    size = len(x_points)\n",
    "    colors = ['red', 'blue', 'orange', 'green'] if not None else colors\n",
    "    for i in range(size):\n",
    "        plt.plot(x_points[i], y_points[i], color=colors[i], marker='o')\n",
    "        # plt.plot(x_points[i], x_points[(i+1) % size],color=colors[i],linestyle=ls, linewidth=lw)\n",
    "        # plt.plot(x_points[i], x_points[(i + 1) % size], linestyle=ls, linewidth=lw)\n",
    "        # [y_points[i], y_points[(i+1) % size]],\n",
    "                 # color=colors[i],\n",
    "                 # linestyle=ls, linewidth=lw)\n",
    "\n",
    "def printCorners(corner_img, mat_homographies):\n",
    "    points = warp_points_np(corner_img, mat_homographies)\n",
    "    # plot\n",
    "    plot_points(corner_img)\n",
    "    for i in range(points.shape[0]):\n",
    "        plot_points(points[i,:,:])\n",
    "\n",
    "def test_sample_homography():\n",
    "    import cv2\n",
    "    batch_size = 10\n",
    "    filename = '../configs/superpoint_coco_train.yaml'\n",
    "    import yaml\n",
    "    with open(filename, 'r') as f:\n",
    "        config = yaml.load(f)\n",
    "    test_tf = False\n",
    "    test_corner_def = True\n",
    "\n",
    "    if test_tf == True:\n",
    "        from utils.homographies import sample_homography as sample_homography\n",
    "        boundary = 1\n",
    "#         from utils.homographies import sample_homography_np as sample_homography\n",
    "        # mat_homographies = matrix[np.newaxis, :,:]\n",
    "        # mat_homographies = [sample_homography(tf.constant([boundary,boundary]),\n",
    "        mat_homographies = [sample_homography(np.array([boundary,boundary]),\n",
    "                                              **config['data']['warped_pair']['params']) for i in range(batch_size)]\n",
    "        mat_homographies = np.stack(mat_homographies, axis=0)\n",
    "        corner_img = np.array([[0., 0.], [0., boundary], [boundary, boundary], [boundary, 0.]])\n",
    "        printCorners(corner_img, mat_homographies)\n",
    "        plt.show()\n",
    "        print(\"try inverse\")\n",
    "        mat_homographies = np.stack(mat_homographies, axis=0)\n",
    "        inv_homographies = np.stack([np.linalg.inv(mat_homographies[i, :, :]) for i in range(mat_homographies.shape[0])])\n",
    "        printCorners(corner_img, inv_homographies)\n",
    "        plt.show()\n",
    "\n",
    "    if test_corner_def:\n",
    "        corner_img = np.array([(-1, -1), (-1, 1), (1, 1), (1, -1)])\n",
    "        offset = 1\n",
    "        corner_img += offset\n",
    "        from utils.homographies import sample_homography_np as sample_homography\n",
    "        boundary = 2\n",
    "        mat_homographies = [sample_homography(np.array([boundary,boundary]), shift=-1 + offset,\n",
    "                                              **config['data']['warped_pair']['params']) for i in range(batch_size)]\n",
    "        mat_homographies = np.stack(mat_homographies, axis=0)\n",
    "        \n",
    "        img = np.zeros((512,512,3), np.uint8)\n",
    "        points = warp_points_np(corner_img, mat_homographies)\n",
    "        \n",
    "        \n",
    "        # draw polygon\n",
    "        img = np.zeros((10,10,3), np.uint8)\n",
    "        points_plt = points.astype(int)\n",
    "#         print(\"points: \", points_plt)\n",
    "#         img_poly = cv2.polylines(img,[points_plt[:1,:,:]],True,(0,255,255))\n",
    "        \n",
    "\n",
    "        points = np.array([(-1, -1), (-1, 1), (1, 1), (1, -1)])\n",
    "        points = points.reshape(-1,4,2)\n",
    "#         img_poly = cv2.polylines(img,[points],True,(0,255,255))\n",
    "#         img_poly = cv2.polylines(img,[points[:1,:,:]],True,(0,255,255))\n",
    "\n",
    "        print(\"shape\", img.shape)\n",
    "        plt.imshow(img_poly)\n",
    "        plt.show()\n",
    "        \n",
    "        points = points.reshape(-1,4,2)\n",
    "#         cv2.polylines(img,[points],True,(0,255,255))\n",
    "#         printCorners(corner_img, mat_homographies)\n",
    "        plt.imshow(img)\n",
    "\n",
    "        print(\"try inverse\")\n",
    "        mat_homographies = np.stack(mat_homographies, axis=0)\n",
    "        inv_homographies = np.stack([np.linalg.inv(mat_homographies[i, :, :]) for i in range(mat_homographies.shape[0])])\n",
    "        printCorners(corner_img, inv_homographies)\n",
    "        plt.show()\n",
    "        \n",
    "\n",
    "    else:\n",
    "        from utils.utils import sample_homography\n",
    "        mat_homographies = [sample_homography(1) for i in range(batch_size)]\n",
    "\n",
    "    print(\"end\")\n",
    "# test_sample_homography()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "# test homography with size(240, 360)\n",
    "\n",
    "import cv2\n",
    "batch_size = 10\n",
    "def loadConfig(filename):\n",
    "    import yaml\n",
    "    with open(filename, 'r') as f:\n",
    "        config = yaml.load(f)\n",
    "    return config\n",
    "test_tf = False\n",
    "test_corner_def = True\n",
    "\n",
    "def scale_homography(H, shape, shift=(-1,-1)):\n",
    "    height, width = shape[0], shape[1]\n",
    "    trans = np.array([[2./width, 0., shift[0]], [0., 2./height, shift[1]], [0., 0., 1.]])\n",
    "    H_tf = np.linalg.inv(trans) @ H @ trans\n",
    "    return H_tf\n",
    "\n",
    "def sample_homography_batches(config, batch_size=1, shape=np.array([1,1]), tf=False):\n",
    "    offset = 0\n",
    "    b = 2\n",
    "\n",
    "    if tf:\n",
    "        from utils.homographies import sample_homography as sample_homography\n",
    "#         shape = np.array([b, b])\n",
    "        mat_homographies = [sample_homography(shape,\n",
    "                                          **config['data']['warped_pair']['params']) for i in range(batch_size)]\n",
    "        \n",
    "#         mat_homographies = [scale_homography(sample_homography(shape,\n",
    "#                                           **config['data']['warped_pair']['params']), shape)\n",
    "#                                             for i in range(batch_size)]\n",
    "    else:\n",
    "        from utils.homographies import sample_homography_np as sample_homography\n",
    "        mat_homographies = [sample_homography(shape, shift=-1 + offset,\n",
    "                                          **config['data']['warped_pair']['params']) for i in range(batch_size)]\n",
    "    \n",
    "    mat_homographies = np.stack(mat_homographies, axis=0)\n",
    "    return mat_homographies\n",
    "\n",
    "\n",
    "\n",
    "def drawBox(points, img, offset=np.array([0,0]), color=(0,255,0)):\n",
    "#     print(\"origin\", points)\n",
    "    offset = offset[::-1]\n",
    "    points = points + offset    \n",
    "    points = points.astype(int)\n",
    "    for i in range(len(points)):\n",
    "        img = img + cv2.line(np.zeros_like(img),tuple(points[-1+i]), tuple(points[i]), color,5)\n",
    "    return img\n",
    "\n",
    "# load config\n",
    "# filename = '../configs/config_test.yaml'\n",
    "# config = loadConfig(filename)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[  1   5]\n",
      " [241   5]\n",
      " [241 325]\n",
      " [  1 325]]\n"
     ]
    }
   ],
   "source": [
    "height, width = 240, 320\n",
    "corner_img = np.array([(0, 0), (height, 0), (height, width), (0, width)])\n",
    "offset = np.array([1,5])\n",
    "print(corner_img + offset)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['homographies', 'masks']\n",
      "[[ 0.8047 -0.0251 -0.0003]\n",
      " [-0.0125  0.919  -0.0549]\n",
      " [ 0.0151 -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rP8uLqVkiJVsfVwEnACqoW4ZWjOrGko4Bbgffa/kXve6O6HgeIYeTXw/aE7RVUv9wrgd8a9jmbYpB0CvCBOpbfB45liH+dtdhGYHndJ384cB6wblqZdcAF9es3A19xQx9viQTczzfJ0NneVf/cA3yO6j98KQ/XfZFTfZJ7Rh2A7YfrX75J4FOM6HrUfY23Ap+xfVt9eKTX40AxlLoe9bl/BtwJvBJ4Tt2aghH+rvTEsMr2bleeBP6Jsr8rRdR/hawFNgDbgZttb5V0uaSz62LXAM+VtIOq775xgEGJBNzPN8lQSTqyvuGCpCOB1wNbZv/UUPV+c14AfGHUAUwlvNqbGMH1qG/6XANst/3RnrdGdj1mimHU10PS8yQ9p379G1Q3qbdTJcE318WGfS0OFMN3er4MRXWDsuTvSjG219t+ie2TbH+wPnaJ7XX16yds/7HtF9teOXWfazZFJmLUQ3r+gWpA87VT/5gRnv83qVq9UN2I/OyoYpB0I9UNpsXAw8ClwOeBm4EXAg8C59p+ZMQxnE7157aBB4B39vTDDiuOVwH/CXwbmBqMeTFVH+xIrscsMaxmhNdD0kupbrItoGoY3Wz78vr/6k1Uf/p/E3hL3RIdZQxfAZ4HCNgMvMv24zPXFP3KTLiIiEKezjfhIiKKSgKOiCgkCTgiopAk4IiIQpKAIyIKSQKOiCgkCTgiopAk4IiIQv4XZoZNQDWIRhcAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "np.set_printoptions(precision=4, suppress=True)\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "import numpy as np\n",
    "a = np.load('notebooks/h2.npz')\n",
    "print(list(a))\n",
    "H = np.squeeze(a['homographies'])\n",
    "print(H)\n",
    "Ms = np.squeeze(a['masks'])\n",
    "\n",
    "plt.imshow(Ms)\n",
    "plt.colorbar()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "def test_valid_mask():\n",
    "    import os\n",
    "    import sys\n",
    "    module_path = os.path.abspath(os.path.join('..'))\n",
    "    if module_path not in sys.path:\n",
    "        sys.path.append(module_path)\n",
    "    from utils.utils import pltImshow\n",
    "#     from utils.homographies import sample_homography as sample_homography\n",
    "    from utils.utils import sample_homography\n",
    "\n",
    "    batch_size = 1\n",
    "    \n",
    "    mat_homographies = [sample_homography(3) for i in range(batch_size)]\n",
    "    mat_H = np.stack(mat_homographies, axis=0)\n",
    "\n",
    "\n",
    "    corner_img = np.array([(-1, -1), (-1, 1), (1, -1), (1, 1)])\n",
    "    # printCorners(corner_img, mat_H)\n",
    "    # points = warp_points_np(corner_img, mat_homographies)\n",
    "\n",
    "    mat_H = torch.tensor(mat_H, dtype=torch.float32)\n",
    "    mat_H_inv = torch.stack([torch.inverse(mat_H[i, :, :]) for i in range(batch_size)])\n",
    "    from utils.utils import compute_valid_mask, labels2Dto3D\n",
    "    device = 'cpu'\n",
    "    shape = torch.tensor([240, 320])\n",
    "    for i in range(1):\n",
    "        r = 3\n",
    "        mask_valid = compute_valid_mask(shape, inv_homography=mat_H_inv, device=device, erosion_radius=r)\n",
    "        pltImshow(mask_valid[0,:,:])\n",
    "        cell_size = 8\n",
    "        mask_valid = labels2Dto3D(mask_valid.view(batch_size, 1, mask_valid.shape[1], mask_valid.shape[2]), cell_size=cell_size)\n",
    "        mask_valid = torch.prod(mask_valid[:,:cell_size*cell_size,:,:], dim=1)\n",
    "        pltImshow(mask_valid[0,:,:].cpu().numpy())\n",
    "        plt.show()\n",
    "\n",
    "    mask = {}\n",
    "    mask.update({'homographies': mat_H, 'masks': mask_valid})\n",
    "    np.savez_compressed('h2.npz', **mask)\n",
    "    print(\"finish testing valid mask\")\n",
    "    return mat_H\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "def my_valid_mask(mat_H):\n",
    "    from utils.utils import compute_valid_mask, labels2Dto3D\n",
    "    from utils.utils import pltImshow\n",
    "    \n",
    "        \n",
    "    r = 3\n",
    "    shape = torch.tensor([240, 320])\n",
    "    device = 'cpu'\n",
    "    mat_H_inv = torch.inverse(mat_H).unsqueeze(dim=0)\n",
    "    mask_valid = compute_valid_mask(shape, inv_homography=mat_H_inv, device=device, erosion_radius=r)\n",
    "    pltImshow(mask_valid[0,:,:])\n",
    "    cell_size = 8\n",
    "    mask_valid = labels2Dto3D(mask_valid.view(1, 1, mask_valid.shape[1], mask_valid.shape[2]), cell_size=cell_size)\n",
    "    mask_valid = torch.prod(mask_valid[:,:cell_size*cell_size,:,:], dim=1)\n",
    "    pltImshow(mask_valid[0,:,:].cpu().numpy())\n",
    "    plt.show()\n",
    "\n",
    "    mask = {}\n",
    "    mask.update({'homographies': mat_H, 'masks': mask_valid})\n",
    "    np.savez_compressed('h2.npz', **mask)\n",
    "    print(\"finish testing valid mask\")\n",
    "    return mat_H"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAU0AAAD8CAYAAADzEfagAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADbNJREFUeJzt3W2MpWV9x/Hvr7As9SEFit2sy6aC2aShSbuSCdLUGFuiwL5ZTAzBF3VjSLZpIdGkfbHWpNoXJraJNjFpMRiJa2NF6kPYF7SIWxLSFyKrXXGBIiNC2HVh6xPSmiDgvy/ONXq6zuzMNefM3Gd2vp/k5Nznuu9zzo9rZn+5H+YcUlVIklbm14YOIEkbiaUpSR0sTUnqYGlKUgdLU5I6WJqS1GHNSjPJtUkeSzKf5MBavY8kraesxd9pJjkH+DbwVuA48CDwzqp6ZOpvJknraK32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R+CDjabntmea7PkHnW5/r3gP9s+Y4Bf93GL2NU4vPAvwBb2/j57fF8W3/ZNPP4iSBJ6jD04bkkbSiWpiR1sDQlqYOlKUkdLE1J6mBpSlIHS1OSOliaktTh/wBTFrhOG+uECwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADG9JREFUeJzt3V+sZfVZxvHvIwyDBUwZwckUiLSEaIjRgRyxpqSpIi1yAySNgYtmLkimMSWBpCZiTRQvTNAIxAuDGQSZKFJrgZQLIp0iCWliKAMOMDBVKELKdJiRYAPeUP68Xpw1yWF8zx/O3mevDX4/yc5e+7fWPuvJj32eWWuvvTmpKiRJ7/dTYweQpHlkOUpSw3KUpIblKEkNy1GSGpajJDUsR0lqWI6S1LAcJalx/CRPTnIp8JfAccDfVNVNK21/QjbXiZw0yS4laSJv8t+vVdXpq2237nJMchzwV8AlwCvA40keqKrnlnvOiZzEr+Xi9e5Skib2nfrmy2vZbpLT6guBF6rqxar6CfB14PIJfp4kzY1JyvEM4IdLHr8yjEnSh95E7zmuRZKdwE6AE/nYRu9OkqZikiPHg8BZSx6fOYy9T1XtqqqFqlrYxOYJdidJszNJOT4OnJvkk0lOAK4CHphOLEka17pPq6vqnSTXAg+x+FGeO6vq2aklk6QRTfSeY1U9CDw4pSySNDf8howkNSxHSWpYjpLUsBwlqWE5SlLDcpSkxoZ/fXCePfSjfWNHkD7yvvCJ7WNHWBePHCWpYTlKUsNylKSG5ShJDctRkhqWoyQ1LEdJaliOktSwHCWp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68DHkxw/rBrtd21JpkuHtySqqt4C/pb5+X17nzHK8XHg3OEq2gnAVcADI+QAIMlJSU45ugx8Hti/8rNm5gFgx7C8A/jWiFmOls9RVzLDeUoS4A7gQFXdsmTVKHO0XJ6x5ijJ6Uk+Piz/NHAJi++DPgJ8cdhspq+hZTJ9f8k/ZmHxPdB5+X17vzGuAgGXsXh17wfAH455RYrFq+ZPDbdnx8oD3MPiadjbLL43dA3ws8DDwPPAd4AtI+f5O+AZ4GkWS2nbDPNcxOIp89PAvuF22VhztEKeUeYI+GXg34b97gf+aBj/FPA94AXgn4DNM/xvtlymfxnmaD/w9wxXtOft5jdkJKnhBRlJaliOktSwHCWpYTlKUsNylKSG5ShJDctRkhqWoyQ1/hcI1nJEyZXSrQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "finish testing valid mask\n",
      "Homography: [[ 0.8047 -0.0251 -0.0003]\n",
      " [-0.0125  0.919  -0.0549]\n",
      " [ 0.0151 -0.0258  1.    ]]\n"
     ]
    }
   ],
   "source": [
    "# H = test_valid_mask()\n",
    "# H = np.squeeze(a['homographies'])\n",
    "my_valid_mask(torch.tensor(H))\n",
    "print('Homography:', H)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[  1.2342   0.0828 -45.5742  -0.002    1.1264  -6.4992  -0.0001   0.0002]\n",
      "[[  1.2342   0.0828 -45.5742]\n",
      " [ -0.002    1.1264  -6.4992]\n",
      " [ -0.0001   0.0002   1.    ]]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWYAAAD0CAYAAACo/4zqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/A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2r+v4Rfg9YNZrQXmG2uFq8xlu7MsBdfaWgkcfZfYi8jd4or9nrOS1OaOx6JlmRZD9wDLif3gjxB1V1coZYXo6z2/888IbliHORHAUu6dte07XNeEyS1wA/Re8m4KxGnZhb986qupxeYf+WJL/cv7P7VG9uWkurcXXuBN4CXEZvBPjx0YbTk+R1wJ8Av11Vf9O/r6XrOUOczV3PqjpVVZfRS1JXAH97xCEtpb3Auq6Gfg69csyuacfsAm7q1n8D+B+D/o9g1Il5mE+bkamqo93PY8AX6P2RPZNkNUD389joIvwxs8XV1DWuqme6f7iTwGfoXVMYYZxJzqaX7P6wqv60a27ues4UZ4vXc0pV/QB4EPgl4MJutDg9lnmPJlvSjfK3AnuAx4GdVXUwye1Jru8O+yzwhq6c9H569yzmNOrEPMynzUgkeW2S86fWgV+jV8Tv//S7CfjiaCJ8hdni2gW8p5tNcCXw/HLUl2czlew6v07vmkIvzs3dXfq1wDrgy8sQT+j9w3m8qj7Rt6up6zlbnA1ezzcmubBb/wng3fQS1oP0Rovwyus5r9Fka6pqd1W9tareUlUf6dpurapd3fqPquofVtXPVtUVU/fUBnU60oXeXe5v0KtDfWjU8fTF9WZ6d7W/Bhycio1e/esB4JvAl4CLRhDbvfT+t/UEvXrdzbPFRe8u+R3d9f06sGHEcf5BF8cBev8oV/cd/6EuzsPAtcsU4zvplSkOAPu75brWrucccbZ2PX8B+GoXz2PArV37m+l9MEwAfwyc27Wf121PdPvfvFx/ny0vPvknSY0ZdSlDkjSNiVmSGmNilqTGmJglqTEmZklqjIlZkhpjYpakxpiYJakx/w9C5YU0F4GdFwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(1, 1, 1, 30, 40)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWAAAAD0CAYAAACl4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B+BTwdts/HXxvXNfjCDGM/XrYnrK9huqXey3wq6M+Z1MMkp4DvKuO5beAUxjhX2cdthVYXffJHw9cAGyaVWYTcFH9+rXAl9zQx1siAQ/zTTJytvfVPw8An6H6D1/KfXVf5Eyf5IFxB2D7vvqXbxr4KGO6HnVf46eAT9j+dH14rNfjSDGUuh71uX8M3Aq8CHhy3ZqCMf6uDMSwzvZ+Vx4B/oGyvytF1H+FbAS2ALuBG23vlHS5pFfVxa4GniJpD1XffeMAgxIJeJhvkpGSdGJ9wwVJJwIvB3bM/6mRGvzmvAj43LgDmEl4tdcwhutR3/S5Gtht+wMDb43teswVw7ivh6SnSnpy/fqXqG5S76ZKgq+ti436Whwphm8NfBmK6gZlyd+VYmxvtv1s22fY/uv62KW2N9WvH7b9+7afZXvtzH2u+RSZiFEP6fk7qgHN18z8Y8Z4/l+havVCdSPyk+OKQdL1VDeYlgP3Ae8BPgvcCDwDuAc43/b9Y47hbKo/tw3cDbx5oB92VHG8GPh34JvAzGDMd1P1wY7leswTw3rGeD0kPZfqJtsSqobRjbYvr/+v3kD1p//XgdfVLdFxxvAl4KmAgO3AW2w/NHdNMazMhIuIKOSxfBMuIqKoJOCIiEKSgCMiCkkCjogoJAk4IqKQJOCIiEKSgCMiCkkCjogo5H8Bk2ZNQMytyWoAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "def compute_valid_mask(image_shape, homography, erosion_radius=0):\n",
    "    \"\"\"\n",
    "    Compute a boolean mask of the valid pixels resulting from an homography applied to\n",
    "    an image of a given shape. Pixels that are False correspond to bordering artifacts.\n",
    "    A margin can be discarded using erosion.\n",
    "    Arguments:\n",
    "        input_shape: Tensor of rank 2 representing the image shape, i.e. `[H, W]`.\n",
    "        homography: Tensor of shape (B, 8) or (8,), where B is the batch size.\n",
    "        erosion_radius: radius of the margin to be discarded.\n",
    "    Returns: a Tensor of type `tf.int32` and shape (H, W).\n",
    "    \"\"\"\n",
    "    mask = H_transform(tf.ones(image_shape), homography, interpolation='NEAREST')\n",
    "    if erosion_radius > 0:\n",
    "        kernel = cv.getStructuringElement(cv.MORPH_ELLIPSE, (erosion_radius*2,)*2)\n",
    "        mask = tf.nn.erosion2d(\n",
    "                mask[tf.newaxis, ..., tf.newaxis],\n",
    "                tf.to_float(tf.constant(kernel)[..., tf.newaxis]),\n",
    "                [1, 1, 1, 1], [1, 1, 1, 1], 'SAME')[0, ..., 0] + 1.\n",
    "    return tf.to_int32(mask)\n",
    "\n",
    "import tensorflow as tf\n",
    "import cv2 as cv\n",
    "from tensorflow.contrib.image import transform as H_transform\n",
    "sess = tf.Session()\n",
    "\n",
    "Hc = 30\n",
    "Wc = 40\n",
    "grid_size = 8\n",
    "Height = Hc * grid_size\n",
    "Width = Wc * grid_size\n",
    "image_shape = tf.constant([Height, Width])\n",
    "# H = np.array([[1., 1., 0.], [0., 1., 0.], [0., 0., 1.]])\n",
    "trans = np.array([[2./Width, 0., -1], [0., 2./Height, -1], [0., 0., 1.]])\n",
    "H_tf = np.linalg.inv(np.linalg.inv(trans) @ H @ trans)\n",
    "H_tf = H_tf / H_tf[2, 2]\n",
    "homography = tf.constant(H_tf.reshape(-1)[:8], tf.float32)\n",
    "# homography = homographysample\n",
    "print(sess.run(homography))\n",
    "print(H_tf)\n",
    "\n",
    "erosion_radius = 3 # from valid_border_margin of https://github.com/rpautrat/SuperPoint/blob/master/superpoint/configs/superpoint_coco.yaml\n",
    "valid_mask = compute_valid_mask(image_shape, homography, erosion_radius)\n",
    "mask = sess.run(valid_mask)\n",
    "\n",
    "plt.imshow(mask)\n",
    "plt.colorbar()\n",
    "plt.show()\n",
    "\n",
    "valid_mask = tf.to_float(valid_mask[tf.newaxis, ..., tf.newaxis])  # for GPU\n",
    "valid_mask = tf.space_to_depth(valid_mask, grid_size)\n",
    "valid_mask = tf.reduce_prod(valid_mask, axis=3)  # AND along the channel dim\n",
    "valid_mask = tf.reshape(valid_mask, [1, 1, 1, Hc, Wc])\n",
    "\n",
    "mask = sess.run(valid_mask)\n",
    "print(mask.shape)\n",
    "\n",
    "plt.imshow(np.squeeze(mask))\n",
    "plt.colorbar()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0.8198, -0.0678, 36.9226],\n",
       "       [ 0.002 ,  0.8933,  5.8966],\n",
       "       [ 0.0001, -0.0002,  1.0106]])"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.linalg.inv(trans) @ H @ trans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[  1.2248,   0.0821, -45.2256],\n",
       "       [ -0.002 ,   1.1178,  -6.4494],\n",
       "       [ -0.0001,   0.0002,   0.9924]])"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.linalg.inv(np.linalg.inv(trans) @ H @ trans)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0.0063,  0.    , -1.    ],\n",
       "       [ 0.    ,  0.0083, -1.    ],\n",
       "       [ 0.    ,  0.    ,  1.    ]])"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "homo  torch.Size([1, 3, 3])\n",
      "shape:  tensor([240., 320.])\n",
      "coor_cells:  tensor([[[ 0,  0],\n",
      "         [ 0,  1],\n",
      "         [ 0,  2],\n",
      "         ...,\n",
      "         [ 0, 37],\n",
      "         [ 0, 38],\n",
      "         [ 0, 39]],\n",
      "\n",
      "        [[ 1,  0],\n",
      "         [ 1,  1],\n",
      "         [ 1,  2],\n",
      "         ...,\n",
      "         [ 1, 37],\n",
      "         [ 1, 38],\n",
      "         [ 1, 39]],\n",
      "\n",
      "        [[ 2,  0],\n",
      "         [ 2,  1],\n",
      "         [ 2,  2],\n",
      "         ...,\n",
      "         [ 2, 37],\n",
      "         [ 2, 38],\n",
      "         [ 2, 39]],\n",
      "\n",
      "        ...,\n",
      "\n",
      "        [[27,  0],\n",
      "         [27,  1],\n",
      "         [27,  2],\n",
      "         ...,\n",
      "         [27, 37],\n",
      "         [27, 38],\n",
      "         [27, 39]],\n",
      "\n",
      "        [[28,  0],\n",
      "         [28,  1],\n",
      "         [28,  2],\n",
      "         ...,\n",
      "         [28, 37],\n",
      "         [28, 38],\n",
      "         [28, 39]],\n",
      "\n",
      "        [[29,  0],\n",
      "         [29,  1],\n",
      "         [29,  2],\n",
      "         ...,\n",
      "         [29, 37],\n",
      "         [29, 38],\n",
      "         [29, 39]]])\n",
      "coor_cells:  tensor([[[ 0.,  0.],\n",
      "         [ 0.,  1.],\n",
      "         [ 0.,  2.],\n",
      "         ...,\n",
      "         [ 0., 37.],\n",
      "         [ 0., 38.],\n",
      "         [ 0., 39.]],\n",
      "\n",
      "        [[ 1.,  0.],\n",
      "         [ 1.,  1.],\n",
      "         [ 1.,  2.],\n",
      "         ...,\n",
      "         [ 1., 37.],\n",
      "         [ 1., 38.],\n",
      "         [ 1., 39.]],\n",
      "\n",
      "        [[ 2.,  0.],\n",
      "         [ 2.,  1.],\n",
      "         [ 2.,  2.],\n",
      "         ...,\n",
      "         [ 2., 37.],\n",
      "         [ 2., 38.],\n",
      "         [ 2., 39.]],\n",
      "\n",
      "        ...,\n",
      "\n",
      "        [[27.,  0.],\n",
      "         [27.,  1.],\n",
      "         [27.,  2.],\n",
      "         ...,\n",
      "         [27., 37.],\n",
      "         [27., 38.],\n",
      "         [27., 39.]],\n",
      "\n",
      "        [[28.,  0.],\n",
      "         [28.,  1.],\n",
      "         [28.,  2.],\n",
      "         ...,\n",
      "         [28., 37.],\n",
      "         [28., 38.],\n",
      "         [28., 39.]],\n",
      "\n",
      "        [[29.,  0.],\n",
      "         [29.,  1.],\n",
      "         [29.,  2.],\n",
      "         ...,\n",
      "         [29., 37.],\n",
      "         [29., 38.],\n",
      "         [29., 39.]]])\n",
      "coor_cells:  tensor([[[  4.,   4.],\n",
      "         [  4.,  12.],\n",
      "         [  4.,  20.],\n",
      "         ...,\n",
      "         [  4., 300.],\n",
      "         [  4., 308.],\n",
      "         [  4., 316.]],\n",
      "\n",
      "        [[ 12.,   4.],\n",
      "         [ 12.,  12.],\n",
      "         [ 12.,  20.],\n",
      "         ...,\n",
      "         [ 12., 300.],\n",
      "         [ 12., 308.],\n",
      "         [ 12., 316.]],\n",
      "\n",
      "        [[ 20.,   4.],\n",
      "         [ 20.,  12.],\n",
      "         [ 20.,  20.],\n",
      "         ...,\n",
      "         [ 20., 300.],\n",
      "         [ 20., 308.],\n",
      "         [ 20., 316.]],\n",
      "\n",
      "        ...,\n",
      "\n",
      "        [[220.,   4.],\n",
      "         [220.,  12.],\n",
      "         [220.,  20.],\n",
      "         ...,\n",
      "         [220., 300.],\n",
      "         [220., 308.],\n",
      "         [220., 316.]],\n",
      "\n",
      "        [[228.,   4.],\n",
      "         [228.,  12.],\n",
      "         [228.,  20.],\n",
      "         ...,\n",
      "         [228., 300.],\n",
      "         [228., 308.],\n",
      "         [228., 316.]],\n",
      "\n",
      "        [[236.,   4.],\n",
      "         [236.,  12.],\n",
      "         [236.,  20.],\n",
      "         ...,\n",
      "         [236., 300.],\n",
      "         [236., 308.],\n",
      "         [236., 316.]]])\n",
      "coor_cells:  tensor([[[[[[  4.,   4.],\n",
      "            [  4.,  12.],\n",
      "            [  4.,  20.],\n",
      "            ...,\n",
      "            [  4., 300.],\n",
      "            [  4., 308.],\n",
      "            [  4., 316.]],\n",
      "\n",
      "           [[ 12.,   4.],\n",
      "            [ 12.,  12.],\n",
      "            [ 12.,  20.],\n",
      "            ...,\n",
      "            [ 12., 300.],\n",
      "            [ 12., 308.],\n",
      "            [ 12., 316.]],\n",
      "\n",
      "           [[ 20.,   4.],\n",
      "            [ 20.,  12.],\n",
      "            [ 20.,  20.],\n",
      "            ...,\n",
      "            [ 20., 300.],\n",
      "            [ 20., 308.],\n",
      "            [ 20., 316.]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[220.,   4.],\n",
      "            [220.,  12.],\n",
      "            [220.,  20.],\n",
      "            ...,\n",
      "            [220., 300.],\n",
      "            [220., 308.],\n",
      "            [220., 316.]],\n",
      "\n",
      "           [[228.,   4.],\n",
      "            [228.,  12.],\n",
      "            [228.,  20.],\n",
      "            ...,\n",
      "            [228., 300.],\n",
      "            [228., 308.],\n",
      "            [228., 316.]],\n",
      "\n",
      "           [[236.,   4.],\n",
      "            [236.,  12.],\n",
      "            [236.,  20.],\n",
      "            ...,\n",
      "            [236., 300.],\n",
      "            [236., 308.],\n",
      "            [236., 316.]]]]]])\n",
      "warped_coor_cells:  tensor([[-0.9667, -0.9750],\n",
      "        [-0.9667, -0.9250],\n",
      "        [-0.9667, -0.8750],\n",
      "        ...,\n",
      "        [ 0.9667,  0.8750],\n",
      "        [ 0.9667,  0.9250],\n",
      "        [ 0.9667,  0.9750]])\n",
      "warped_coor_cells:  tensor([[-0.9750, -0.9667],\n",
      "        [-0.9250, -0.9667],\n",
      "        [-0.8750, -0.9667],\n",
      "        ...,\n",
      "        [ 0.8750,  0.9667],\n",
      "        [ 0.9250,  0.9667],\n",
      "        [ 0.9750,  0.9667]])\n",
      "warped_coor_cells:  tensor([[[-0.7529, -0.9218],\n",
      "         [-0.7126, -0.9217],\n",
      "         [-0.6723, -0.9217],\n",
      "         ...,\n",
      "         [ 0.6876,  0.8323],\n",
      "         [ 0.7277,  0.8310],\n",
      "         [ 0.7678,  0.8298]]])\n",
      "shape:  torch.Size([1, 1200, 2])\n",
      "warped_coor_cells:  tensor([[[-0.9218, -0.7529],\n",
      "         [-0.9217, -0.7126],\n",
      "         [-0.9217, -0.6723],\n",
      "         ...,\n",
      "         [ 0.8323,  0.6876],\n",
      "         [ 0.8310,  0.7277],\n",
      "         [ 0.8298,  0.7678]]])\n",
      "warped:  tensor([[ 9.3826, 39.5296],\n",
      "        [ 9.3914, 45.9880],\n",
      "        [ 9.4001, 52.4368],\n",
      "        [ 9.4089, 58.8759],\n",
      "        [ 9.4176, 65.3054],\n",
      "        [ 9.4263, 71.7253],\n",
      "        [ 9.4350, 78.1356],\n",
      "        [ 9.4437, 84.5364],\n",
      "        [ 9.4524, 90.9276],\n",
      "        [ 9.4611, 97.3094]])\n",
      "cell_distances:  tensor([[[[[[-5.3826e+00, -3.5530e+01],\n",
      "            [-5.3826e+00, -2.7530e+01],\n",
      "            [-5.3826e+00, -1.9530e+01],\n",
      "            ...,\n",
      "            [-5.3826e+00,  2.6047e+02],\n",
      "            [-5.3826e+00,  2.6847e+02],\n",
      "            [-5.3826e+00,  2.7647e+02]],\n",
      "\n",
      "           [[ 2.6174e+00, -3.5530e+01],\n",
      "            [ 2.6174e+00, -2.7530e+01],\n",
      "            [ 2.6174e+00, -1.9530e+01],\n",
      "            ...,\n",
      "            [ 2.6174e+00,  2.6047e+02],\n",
      "            [ 2.6174e+00,  2.6847e+02],\n",
      "            [ 2.6174e+00,  2.7647e+02]],\n",
      "\n",
      "           [[ 1.0617e+01, -3.5530e+01],\n",
      "            [ 1.0617e+01, -2.7530e+01],\n",
      "            [ 1.0617e+01, -1.9530e+01],\n",
      "            ...,\n",
      "            [ 1.0617e+01,  2.6047e+02],\n",
      "            [ 1.0617e+01,  2.6847e+02],\n",
      "            [ 1.0617e+01,  2.7647e+02]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 2.1062e+02, -3.5530e+01],\n",
      "            [ 2.1062e+02, -2.7530e+01],\n",
      "            [ 2.1062e+02, -1.9530e+01],\n",
      "            ...,\n",
      "            [ 2.1062e+02,  2.6047e+02],\n",
      "            [ 2.1062e+02,  2.6847e+02],\n",
      "            [ 2.1062e+02,  2.7647e+02]],\n",
      "\n",
      "           [[ 2.1862e+02, -3.5530e+01],\n",
      "            [ 2.1862e+02, -2.7530e+01],\n",
      "            [ 2.1862e+02, -1.9530e+01],\n",
      "            ...,\n",
      "            [ 2.1862e+02,  2.6047e+02],\n",
      "            [ 2.1862e+02,  2.6847e+02],\n",
      "            [ 2.1862e+02,  2.7647e+02]],\n",
      "\n",
      "           [[ 2.2662e+02, -3.5530e+01],\n",
      "            [ 2.2662e+02, -2.7530e+01],\n",
      "            [ 2.2662e+02, -1.9530e+01],\n",
      "            ...,\n",
      "            [ 2.2662e+02,  2.6047e+02],\n",
      "            [ 2.2662e+02,  2.6847e+02],\n",
      "            [ 2.2662e+02,  2.7647e+02]]],\n",
      "\n",
      "\n",
      "          [[[-5.3914e+00, -4.1988e+01],\n",
      "            [-5.3914e+00, -3.3988e+01],\n",
      "            [-5.3914e+00, -2.5988e+01],\n",
      "            ...,\n",
      "            [-5.3914e+00,  2.5401e+02],\n",
      "            [-5.3914e+00,  2.6201e+02],\n",
      "            [-5.3914e+00,  2.7001e+02]],\n",
      "\n",
      "           [[ 2.6086e+00, -4.1988e+01],\n",
      "            [ 2.6086e+00, -3.3988e+01],\n",
      "            [ 2.6086e+00, -2.5988e+01],\n",
      "            ...,\n",
      "            [ 2.6086e+00,  2.5401e+02],\n",
      "            [ 2.6086e+00,  2.6201e+02],\n",
      "            [ 2.6086e+00,  2.7001e+02]],\n",
      "\n",
      "           [[ 1.0609e+01, -4.1988e+01],\n",
      "            [ 1.0609e+01, -3.3988e+01],\n",
      "            [ 1.0609e+01, -2.5988e+01],\n",
      "            ...,\n",
      "            [ 1.0609e+01,  2.5401e+02],\n",
      "            [ 1.0609e+01,  2.6201e+02],\n",
      "            [ 1.0609e+01,  2.7001e+02]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 2.1061e+02, -4.1988e+01],\n",
      "            [ 2.1061e+02, -3.3988e+01],\n",
      "            [ 2.1061e+02, -2.5988e+01],\n",
      "            ...,\n",
      "            [ 2.1061e+02,  2.5401e+02],\n",
      "            [ 2.1061e+02,  2.6201e+02],\n",
      "            [ 2.1061e+02,  2.7001e+02]],\n",
      "\n",
      "           [[ 2.1861e+02, -4.1988e+01],\n",
      "            [ 2.1861e+02, -3.3988e+01],\n",
      "            [ 2.1861e+02, -2.5988e+01],\n",
      "            ...,\n",
      "            [ 2.1861e+02,  2.5401e+02],\n",
      "            [ 2.1861e+02,  2.6201e+02],\n",
      "            [ 2.1861e+02,  2.7001e+02]],\n",
      "\n",
      "           [[ 2.2661e+02, -4.1988e+01],\n",
      "            [ 2.2661e+02, -3.3988e+01],\n",
      "            [ 2.2661e+02, -2.5988e+01],\n",
      "            ...,\n",
      "            [ 2.2661e+02,  2.5401e+02],\n",
      "            [ 2.2661e+02,  2.6201e+02],\n",
      "            [ 2.2661e+02,  2.7001e+02]]],\n",
      "\n",
      "\n",
      "          [[[-5.4001e+00, -4.8437e+01],\n",
      "            [-5.4001e+00, -4.0437e+01],\n",
      "            [-5.4001e+00, -3.2437e+01],\n",
      "            ...,\n",
      "            [-5.4001e+00,  2.4756e+02],\n",
      "            [-5.4001e+00,  2.5556e+02],\n",
      "            [-5.4001e+00,  2.6356e+02]],\n",
      "\n",
      "           [[ 2.5999e+00, -4.8437e+01],\n",
      "            [ 2.5999e+00, -4.0437e+01],\n",
      "            [ 2.5999e+00, -3.2437e+01],\n",
      "            ...,\n",
      "            [ 2.5999e+00,  2.4756e+02],\n",
      "            [ 2.5999e+00,  2.5556e+02],\n",
      "            [ 2.5999e+00,  2.6356e+02]],\n",
      "\n",
      "           [[ 1.0600e+01, -4.8437e+01],\n",
      "            [ 1.0600e+01, -4.0437e+01],\n",
      "            [ 1.0600e+01, -3.2437e+01],\n",
      "            ...,\n",
      "            [ 1.0600e+01,  2.4756e+02],\n",
      "            [ 1.0600e+01,  2.5556e+02],\n",
      "            [ 1.0600e+01,  2.6356e+02]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 2.1060e+02, -4.8437e+01],\n",
      "            [ 2.1060e+02, -4.0437e+01],\n",
      "            [ 2.1060e+02, -3.2437e+01],\n",
      "            ...,\n",
      "            [ 2.1060e+02,  2.4756e+02],\n",
      "            [ 2.1060e+02,  2.5556e+02],\n",
      "            [ 2.1060e+02,  2.6356e+02]],\n",
      "\n",
      "           [[ 2.1860e+02, -4.8437e+01],\n",
      "            [ 2.1860e+02, -4.0437e+01],\n",
      "            [ 2.1860e+02, -3.2437e+01],\n",
      "            ...,\n",
      "            [ 2.1860e+02,  2.4756e+02],\n",
      "            [ 2.1860e+02,  2.5556e+02],\n",
      "            [ 2.1860e+02,  2.6356e+02]],\n",
      "\n",
      "           [[ 2.2660e+02, -4.8437e+01],\n",
      "            [ 2.2660e+02, -4.0437e+01],\n",
      "            [ 2.2660e+02, -3.2437e+01],\n",
      "            ...,\n",
      "            [ 2.2660e+02,  2.4756e+02],\n",
      "            [ 2.2660e+02,  2.5556e+02],\n",
      "            [ 2.2660e+02,  2.6356e+02]]],\n",
      "\n",
      "\n",
      "          ...,\n",
      "\n",
      "\n",
      "          [[[-5.6986e+00, -2.6822e+02],\n",
      "            [-5.6986e+00, -2.6022e+02],\n",
      "            [-5.6986e+00, -2.5222e+02],\n",
      "            ...,\n",
      "            [-5.6986e+00,  2.7778e+01],\n",
      "            [-5.6986e+00,  3.5778e+01],\n",
      "            [-5.6986e+00,  4.3778e+01]],\n",
      "\n",
      "           [[ 2.3014e+00, -2.6822e+02],\n",
      "            [ 2.3014e+00, -2.6022e+02],\n",
      "            [ 2.3014e+00, -2.5222e+02],\n",
      "            ...,\n",
      "            [ 2.3014e+00,  2.7778e+01],\n",
      "            [ 2.3014e+00,  3.5778e+01],\n",
      "            [ 2.3014e+00,  4.3778e+01]],\n",
      "\n",
      "           [[ 1.0301e+01, -2.6822e+02],\n",
      "            [ 1.0301e+01, -2.6022e+02],\n",
      "            [ 1.0301e+01, -2.5222e+02],\n",
      "            ...,\n",
      "            [ 1.0301e+01,  2.7778e+01],\n",
      "            [ 1.0301e+01,  3.5778e+01],\n",
      "            [ 1.0301e+01,  4.3778e+01]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 2.1030e+02, -2.6822e+02],\n",
      "            [ 2.1030e+02, -2.6022e+02],\n",
      "            [ 2.1030e+02, -2.5222e+02],\n",
      "            ...,\n",
      "            [ 2.1030e+02,  2.7778e+01],\n",
      "            [ 2.1030e+02,  3.5778e+01],\n",
      "            [ 2.1030e+02,  4.3778e+01]],\n",
      "\n",
      "           [[ 2.1830e+02, -2.6822e+02],\n",
      "            [ 2.1830e+02, -2.6022e+02],\n",
      "            [ 2.1830e+02, -2.5222e+02],\n",
      "            ...,\n",
      "            [ 2.1830e+02,  2.7778e+01],\n",
      "            [ 2.1830e+02,  3.5778e+01],\n",
      "            [ 2.1830e+02,  4.3778e+01]],\n",
      "\n",
      "           [[ 2.2630e+02, -2.6822e+02],\n",
      "            [ 2.2630e+02, -2.6022e+02],\n",
      "            [ 2.2630e+02, -2.5222e+02],\n",
      "            ...,\n",
      "            [ 2.2630e+02,  2.7778e+01],\n",
      "            [ 2.2630e+02,  3.5778e+01],\n",
      "            [ 2.2630e+02,  4.3778e+01]]],\n",
      "\n",
      "\n",
      "          [[[-5.7069e+00, -2.7434e+02],\n",
      "            [-5.7069e+00, -2.6634e+02],\n",
      "            [-5.7069e+00, -2.5834e+02],\n",
      "            ...,\n",
      "            [-5.7069e+00,  2.1663e+01],\n",
      "            [-5.7069e+00,  2.9663e+01],\n",
      "            [-5.7069e+00,  3.7663e+01]],\n",
      "\n",
      "           [[ 2.2931e+00, -2.7434e+02],\n",
      "            [ 2.2931e+00, -2.6634e+02],\n",
      "            [ 2.2931e+00, -2.5834e+02],\n",
      "            ...,\n",
      "            [ 2.2931e+00,  2.1663e+01],\n",
      "            [ 2.2931e+00,  2.9663e+01],\n",
      "            [ 2.2931e+00,  3.7663e+01]],\n",
      "\n",
      "           [[ 1.0293e+01, -2.7434e+02],\n",
      "            [ 1.0293e+01, -2.6634e+02],\n",
      "            [ 1.0293e+01, -2.5834e+02],\n",
      "            ...,\n",
      "            [ 1.0293e+01,  2.1663e+01],\n",
      "            [ 1.0293e+01,  2.9663e+01],\n",
      "            [ 1.0293e+01,  3.7663e+01]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 2.1029e+02, -2.7434e+02],\n",
      "            [ 2.1029e+02, -2.6634e+02],\n",
      "            [ 2.1029e+02, -2.5834e+02],\n",
      "            ...,\n",
      "            [ 2.1029e+02,  2.1663e+01],\n",
      "            [ 2.1029e+02,  2.9663e+01],\n",
      "            [ 2.1029e+02,  3.7663e+01]],\n",
      "\n",
      "           [[ 2.1829e+02, -2.7434e+02],\n",
      "            [ 2.1829e+02, -2.6634e+02],\n",
      "            [ 2.1829e+02, -2.5834e+02],\n",
      "            ...,\n",
      "            [ 2.1829e+02,  2.1663e+01],\n",
      "            [ 2.1829e+02,  2.9663e+01],\n",
      "            [ 2.1829e+02,  3.7663e+01]],\n",
      "\n",
      "           [[ 2.2629e+02, -2.7434e+02],\n",
      "            [ 2.2629e+02, -2.6634e+02],\n",
      "            [ 2.2629e+02, -2.5834e+02],\n",
      "            ...,\n",
      "            [ 2.2629e+02,  2.1663e+01],\n",
      "            [ 2.2629e+02,  2.9663e+01],\n",
      "            [ 2.2629e+02,  3.7663e+01]]],\n",
      "\n",
      "\n",
      "          [[[-5.7152e+00, -2.8044e+02],\n",
      "            [-5.7152e+00, -2.7244e+02],\n",
      "            [-5.7152e+00, -2.6444e+02],\n",
      "            ...,\n",
      "            [-5.7152e+00,  1.5557e+01],\n",
      "            [-5.7152e+00,  2.3557e+01],\n",
      "            [-5.7152e+00,  3.1557e+01]],\n",
      "\n",
      "           [[ 2.2848e+00, -2.8044e+02],\n",
      "            [ 2.2848e+00, -2.7244e+02],\n",
      "            [ 2.2848e+00, -2.6444e+02],\n",
      "            ...,\n",
      "            [ 2.2848e+00,  1.5557e+01],\n",
      "            [ 2.2848e+00,  2.3557e+01],\n",
      "            [ 2.2848e+00,  3.1557e+01]],\n",
      "\n",
      "           [[ 1.0285e+01, -2.8044e+02],\n",
      "            [ 1.0285e+01, -2.7244e+02],\n",
      "            [ 1.0285e+01, -2.6444e+02],\n",
      "            ...,\n",
      "            [ 1.0285e+01,  1.5557e+01],\n",
      "            [ 1.0285e+01,  2.3557e+01],\n",
      "            [ 1.0285e+01,  3.1557e+01]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 2.1028e+02, -2.8044e+02],\n",
      "            [ 2.1028e+02, -2.7244e+02],\n",
      "            [ 2.1028e+02, -2.6444e+02],\n",
      "            ...,\n",
      "            [ 2.1028e+02,  1.5557e+01],\n",
      "            [ 2.1028e+02,  2.3557e+01],\n",
      "            [ 2.1028e+02,  3.1557e+01]],\n",
      "\n",
      "           [[ 2.1828e+02, -2.8044e+02],\n",
      "            [ 2.1828e+02, -2.7244e+02],\n",
      "            [ 2.1828e+02, -2.6444e+02],\n",
      "            ...,\n",
      "            [ 2.1828e+02,  1.5557e+01],\n",
      "            [ 2.1828e+02,  2.3557e+01],\n",
      "            [ 2.1828e+02,  3.1557e+01]],\n",
      "\n",
      "           [[ 2.2628e+02, -2.8044e+02],\n",
      "            [ 2.2628e+02, -2.7244e+02],\n",
      "            [ 2.2628e+02, -2.6444e+02],\n",
      "            ...,\n",
      "            [ 2.2628e+02,  1.5557e+01],\n",
      "            [ 2.2628e+02,  2.3557e+01],\n",
      "            [ 2.2628e+02,  3.1557e+01]]]],\n",
      "\n",
      "\n",
      "\n",
      "         [[[[-1.2485e+01, -3.5059e+01],\n",
      "            [-1.2485e+01, -2.7059e+01],\n",
      "            [-1.2485e+01, -1.9059e+01],\n",
      "            ...,\n",
      "            [-1.2485e+01,  2.6094e+02],\n",
      "            [-1.2485e+01,  2.6894e+02],\n",
      "            [-1.2485e+01,  2.7694e+02]],\n",
      "\n",
      "           [[-4.4852e+00, -3.5059e+01],\n",
      "            [-4.4852e+00, -2.7059e+01],\n",
      "            [-4.4852e+00, -1.9059e+01],\n",
      "            ...,\n",
      "            [-4.4852e+00,  2.6094e+02],\n",
      "            [-4.4852e+00,  2.6894e+02],\n",
      "            [-4.4852e+00,  2.7694e+02]],\n",
      "\n",
      "           [[ 3.5148e+00, -3.5059e+01],\n",
      "            [ 3.5148e+00, -2.7059e+01],\n",
      "            [ 3.5148e+00, -1.9059e+01],\n",
      "            ...,\n",
      "            [ 3.5148e+00,  2.6094e+02],\n",
      "            [ 3.5148e+00,  2.6894e+02],\n",
      "            [ 3.5148e+00,  2.7694e+02]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 2.0351e+02, -3.5059e+01],\n",
      "            [ 2.0351e+02, -2.7059e+01],\n",
      "            [ 2.0351e+02, -1.9059e+01],\n",
      "            ...,\n",
      "            [ 2.0351e+02,  2.6094e+02],\n",
      "            [ 2.0351e+02,  2.6894e+02],\n",
      "            [ 2.0351e+02,  2.7694e+02]],\n",
      "\n",
      "           [[ 2.1151e+02, -3.5059e+01],\n",
      "            [ 2.1151e+02, -2.7059e+01],\n",
      "            [ 2.1151e+02, -1.9059e+01],\n",
      "            ...,\n",
      "            [ 2.1151e+02,  2.6094e+02],\n",
      "            [ 2.1151e+02,  2.6894e+02],\n",
      "            [ 2.1151e+02,  2.7694e+02]],\n",
      "\n",
      "           [[ 2.1951e+02, -3.5059e+01],\n",
      "            [ 2.1951e+02, -2.7059e+01],\n",
      "            [ 2.1951e+02, -1.9059e+01],\n",
      "            ...,\n",
      "            [ 2.1951e+02,  2.6094e+02],\n",
      "            [ 2.1951e+02,  2.6894e+02],\n",
      "            [ 2.1951e+02,  2.7694e+02]]],\n",
      "\n",
      "\n",
      "          [[[-1.2489e+01, -4.1529e+01],\n",
      "            [-1.2489e+01, -3.3529e+01],\n",
      "            [-1.2489e+01, -2.5529e+01],\n",
      "            ...,\n",
      "            [-1.2489e+01,  2.5447e+02],\n",
      "            [-1.2489e+01,  2.6247e+02],\n",
      "            [-1.2489e+01,  2.7047e+02]],\n",
      "\n",
      "           [[-4.4886e+00, -4.1529e+01],\n",
      "            [-4.4886e+00, -3.3529e+01],\n",
      "            [-4.4886e+00, -2.5529e+01],\n",
      "            ...,\n",
      "            [-4.4886e+00,  2.5447e+02],\n",
      "            [-4.4886e+00,  2.6247e+02],\n",
      "            [-4.4886e+00,  2.7047e+02]],\n",
      "\n",
      "           [[ 3.5114e+00, -4.1529e+01],\n",
      "            [ 3.5114e+00, -3.3529e+01],\n",
      "            [ 3.5114e+00, -2.5529e+01],\n",
      "            ...,\n",
      "            [ 3.5114e+00,  2.5447e+02],\n",
      "            [ 3.5114e+00,  2.6247e+02],\n",
      "            [ 3.5114e+00,  2.7047e+02]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 2.0351e+02, -4.1529e+01],\n",
      "            [ 2.0351e+02, -3.3529e+01],\n",
      "            [ 2.0351e+02, -2.5529e+01],\n",
      "            ...,\n",
      "            [ 2.0351e+02,  2.5447e+02],\n",
      "            [ 2.0351e+02,  2.6247e+02],\n",
      "            [ 2.0351e+02,  2.7047e+02]],\n",
      "\n",
      "           [[ 2.1151e+02, -4.1529e+01],\n",
      "            [ 2.1151e+02, -3.3529e+01],\n",
      "            [ 2.1151e+02, -2.5529e+01],\n",
      "            ...,\n",
      "            [ 2.1151e+02,  2.5447e+02],\n",
      "            [ 2.1151e+02,  2.6247e+02],\n",
      "            [ 2.1151e+02,  2.7047e+02]],\n",
      "\n",
      "           [[ 2.1951e+02, -4.1529e+01],\n",
      "            [ 2.1951e+02, -3.3529e+01],\n",
      "            [ 2.1951e+02, -2.5529e+01],\n",
      "            ...,\n",
      "            [ 2.1951e+02,  2.5447e+02],\n",
      "            [ 2.1951e+02,  2.6247e+02],\n",
      "            [ 2.1951e+02,  2.7047e+02]]],\n",
      "\n",
      "\n",
      "          [[[-1.2492e+01, -4.7989e+01],\n",
      "            [-1.2492e+01, -3.9989e+01],\n",
      "            [-1.2492e+01, -3.1989e+01],\n",
      "            ...,\n",
      "            [-1.2492e+01,  2.4801e+02],\n",
      "            [-1.2492e+01,  2.5601e+02],\n",
      "            [-1.2492e+01,  2.6401e+02]],\n",
      "\n",
      "           [[-4.4921e+00, -4.7989e+01],\n",
      "            [-4.4921e+00, -3.9989e+01],\n",
      "            [-4.4921e+00, -3.1989e+01],\n",
      "            ...,\n",
      "            [-4.4921e+00,  2.4801e+02],\n",
      "            [-4.4921e+00,  2.5601e+02],\n",
      "            [-4.4921e+00,  2.6401e+02]],\n",
      "\n",
      "           [[ 3.5079e+00, -4.7989e+01],\n",
      "            [ 3.5079e+00, -3.9989e+01],\n",
      "            [ 3.5079e+00, -3.1989e+01],\n",
      "            ...,\n",
      "            [ 3.5079e+00,  2.4801e+02],\n",
      "            [ 3.5079e+00,  2.5601e+02],\n",
      "            [ 3.5079e+00,  2.6401e+02]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 2.0351e+02, -4.7989e+01],\n",
      "            [ 2.0351e+02, -3.9989e+01],\n",
      "            [ 2.0351e+02, -3.1989e+01],\n",
      "            ...,\n",
      "            [ 2.0351e+02,  2.4801e+02],\n",
      "            [ 2.0351e+02,  2.5601e+02],\n",
      "            [ 2.0351e+02,  2.6401e+02]],\n",
      "\n",
      "           [[ 2.1151e+02, -4.7989e+01],\n",
      "            [ 2.1151e+02, -3.9989e+01],\n",
      "            [ 2.1151e+02, -3.1989e+01],\n",
      "            ...,\n",
      "            [ 2.1151e+02,  2.4801e+02],\n",
      "            [ 2.1151e+02,  2.5601e+02],\n",
      "            [ 2.1151e+02,  2.6401e+02]],\n",
      "\n",
      "           [[ 2.1951e+02, -4.7989e+01],\n",
      "            [ 2.1951e+02, -3.9989e+01],\n",
      "            [ 2.1951e+02, -3.1989e+01],\n",
      "            ...,\n",
      "            [ 2.1951e+02,  2.4801e+02],\n",
      "            [ 2.1951e+02,  2.5601e+02],\n",
      "            [ 2.1951e+02,  2.6401e+02]]],\n",
      "\n",
      "\n",
      "          ...,\n",
      "\n",
      "\n",
      "          [[[-1.2610e+01, -2.6815e+02],\n",
      "            [-1.2610e+01, -2.6015e+02],\n",
      "            [-1.2610e+01, -2.5215e+02],\n",
      "            ...,\n",
      "            [-1.2610e+01,  2.7851e+01],\n",
      "            [-1.2610e+01,  3.5851e+01],\n",
      "            [-1.2610e+01,  4.3851e+01]],\n",
      "\n",
      "           [[-4.6099e+00, -2.6815e+02],\n",
      "            [-4.6099e+00, -2.6015e+02],\n",
      "            [-4.6099e+00, -2.5215e+02],\n",
      "            ...,\n",
      "            [-4.6099e+00,  2.7851e+01],\n",
      "            [-4.6099e+00,  3.5851e+01],\n",
      "            [-4.6099e+00,  4.3851e+01]],\n",
      "\n",
      "           [[ 3.3901e+00, -2.6815e+02],\n",
      "            [ 3.3901e+00, -2.6015e+02],\n",
      "            [ 3.3901e+00, -2.5215e+02],\n",
      "            ...,\n",
      "            [ 3.3901e+00,  2.7851e+01],\n",
      "            [ 3.3901e+00,  3.5851e+01],\n",
      "            [ 3.3901e+00,  4.3851e+01]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 2.0339e+02, -2.6815e+02],\n",
      "            [ 2.0339e+02, -2.6015e+02],\n",
      "            [ 2.0339e+02, -2.5215e+02],\n",
      "            ...,\n",
      "            [ 2.0339e+02,  2.7851e+01],\n",
      "            [ 2.0339e+02,  3.5851e+01],\n",
      "            [ 2.0339e+02,  4.3851e+01]],\n",
      "\n",
      "           [[ 2.1139e+02, -2.6815e+02],\n",
      "            [ 2.1139e+02, -2.6015e+02],\n",
      "            [ 2.1139e+02, -2.5215e+02],\n",
      "            ...,\n",
      "            [ 2.1139e+02,  2.7851e+01],\n",
      "            [ 2.1139e+02,  3.5851e+01],\n",
      "            [ 2.1139e+02,  4.3851e+01]],\n",
      "\n",
      "           [[ 2.1939e+02, -2.6815e+02],\n",
      "            [ 2.1939e+02, -2.6015e+02],\n",
      "            [ 2.1939e+02, -2.5215e+02],\n",
      "            ...,\n",
      "            [ 2.1939e+02,  2.7851e+01],\n",
      "            [ 2.1939e+02,  3.5851e+01],\n",
      "            [ 2.1939e+02,  4.3851e+01]]],\n",
      "\n",
      "\n",
      "          [[[-1.2613e+01, -2.7427e+02],\n",
      "            [-1.2613e+01, -2.6627e+02],\n",
      "            [-1.2613e+01, -2.5827e+02],\n",
      "            ...,\n",
      "            [-1.2613e+01,  2.1725e+01],\n",
      "            [-1.2613e+01,  2.9725e+01],\n",
      "            [-1.2613e+01,  3.7725e+01]],\n",
      "\n",
      "           [[-4.6132e+00, -2.7427e+02],\n",
      "            [-4.6132e+00, -2.6627e+02],\n",
      "            [-4.6132e+00, -2.5827e+02],\n",
      "            ...,\n",
      "            [-4.6132e+00,  2.1725e+01],\n",
      "            [-4.6132e+00,  2.9725e+01],\n",
      "            [-4.6132e+00,  3.7725e+01]],\n",
      "\n",
      "           [[ 3.3868e+00, -2.7427e+02],\n",
      "            [ 3.3868e+00, -2.6627e+02],\n",
      "            [ 3.3868e+00, -2.5827e+02],\n",
      "            ...,\n",
      "            [ 3.3868e+00,  2.1725e+01],\n",
      "            [ 3.3868e+00,  2.9725e+01],\n",
      "            [ 3.3868e+00,  3.7725e+01]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 2.0339e+02, -2.7427e+02],\n",
      "            [ 2.0339e+02, -2.6627e+02],\n",
      "            [ 2.0339e+02, -2.5827e+02],\n",
      "            ...,\n",
      "            [ 2.0339e+02,  2.1725e+01],\n",
      "            [ 2.0339e+02,  2.9725e+01],\n",
      "            [ 2.0339e+02,  3.7725e+01]],\n",
      "\n",
      "           [[ 2.1139e+02, -2.7427e+02],\n",
      "            [ 2.1139e+02, -2.6627e+02],\n",
      "            [ 2.1139e+02, -2.5827e+02],\n",
      "            ...,\n",
      "            [ 2.1139e+02,  2.1725e+01],\n",
      "            [ 2.1139e+02,  2.9725e+01],\n",
      "            [ 2.1139e+02,  3.7725e+01]],\n",
      "\n",
      "           [[ 2.1939e+02, -2.7427e+02],\n",
      "            [ 2.1939e+02, -2.6627e+02],\n",
      "            [ 2.1939e+02, -2.5827e+02],\n",
      "            ...,\n",
      "            [ 2.1939e+02,  2.1725e+01],\n",
      "            [ 2.1939e+02,  2.9725e+01],\n",
      "            [ 2.1939e+02,  3.7725e+01]]],\n",
      "\n",
      "\n",
      "          [[[-1.2616e+01, -2.8039e+02],\n",
      "            [-1.2616e+01, -2.7239e+02],\n",
      "            [-1.2616e+01, -2.6439e+02],\n",
      "            ...,\n",
      "            [-1.2616e+01,  1.5609e+01],\n",
      "            [-1.2616e+01,  2.3609e+01],\n",
      "            [-1.2616e+01,  3.1609e+01]],\n",
      "\n",
      "           [[-4.6164e+00, -2.8039e+02],\n",
      "            [-4.6164e+00, -2.7239e+02],\n",
      "            [-4.6164e+00, -2.6439e+02],\n",
      "            ...,\n",
      "            [-4.6164e+00,  1.5609e+01],\n",
      "            [-4.6164e+00,  2.3609e+01],\n",
      "            [-4.6164e+00,  3.1609e+01]],\n",
      "\n",
      "           [[ 3.3836e+00, -2.8039e+02],\n",
      "            [ 3.3836e+00, -2.7239e+02],\n",
      "            [ 3.3836e+00, -2.6439e+02],\n",
      "            ...,\n",
      "            [ 3.3836e+00,  1.5609e+01],\n",
      "            [ 3.3836e+00,  2.3609e+01],\n",
      "            [ 3.3836e+00,  3.1609e+01]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 2.0338e+02, -2.8039e+02],\n",
      "            [ 2.0338e+02, -2.7239e+02],\n",
      "            [ 2.0338e+02, -2.6439e+02],\n",
      "            ...,\n",
      "            [ 2.0338e+02,  1.5609e+01],\n",
      "            [ 2.0338e+02,  2.3609e+01],\n",
      "            [ 2.0338e+02,  3.1609e+01]],\n",
      "\n",
      "           [[ 2.1138e+02, -2.8039e+02],\n",
      "            [ 2.1138e+02, -2.7239e+02],\n",
      "            [ 2.1138e+02, -2.6439e+02],\n",
      "            ...,\n",
      "            [ 2.1138e+02,  1.5609e+01],\n",
      "            [ 2.1138e+02,  2.3609e+01],\n",
      "            [ 2.1138e+02,  3.1609e+01]],\n",
      "\n",
      "           [[ 2.1938e+02, -2.8039e+02],\n",
      "            [ 2.1938e+02, -2.7239e+02],\n",
      "            [ 2.1938e+02, -2.6439e+02],\n",
      "            ...,\n",
      "            [ 2.1938e+02,  1.5609e+01],\n",
      "            [ 2.1938e+02,  2.3609e+01],\n",
      "            [ 2.1938e+02,  3.1609e+01]]]],\n",
      "\n",
      "\n",
      "\n",
      "         [[[[-1.9612e+01, -3.4586e+01],\n",
      "            [-1.9612e+01, -2.6586e+01],\n",
      "            [-1.9612e+01, -1.8586e+01],\n",
      "            ...,\n",
      "            [-1.9612e+01,  2.6141e+02],\n",
      "            [-1.9612e+01,  2.6941e+02],\n",
      "            [-1.9612e+01,  2.7741e+02]],\n",
      "\n",
      "           [[-1.1612e+01, -3.4586e+01],\n",
      "            [-1.1612e+01, -2.6586e+01],\n",
      "            [-1.1612e+01, -1.8586e+01],\n",
      "            ...,\n",
      "            [-1.1612e+01,  2.6141e+02],\n",
      "            [-1.1612e+01,  2.6941e+02],\n",
      "            [-1.1612e+01,  2.7741e+02]],\n",
      "\n",
      "           [[-3.6120e+00, -3.4586e+01],\n",
      "            [-3.6120e+00, -2.6586e+01],\n",
      "            [-3.6120e+00, -1.8586e+01],\n",
      "            ...,\n",
      "            [-3.6120e+00,  2.6141e+02],\n",
      "            [-3.6120e+00,  2.6941e+02],\n",
      "            [-3.6120e+00,  2.7741e+02]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 1.9639e+02, -3.4586e+01],\n",
      "            [ 1.9639e+02, -2.6586e+01],\n",
      "            [ 1.9639e+02, -1.8586e+01],\n",
      "            ...,\n",
      "            [ 1.9639e+02,  2.6141e+02],\n",
      "            [ 1.9639e+02,  2.6941e+02],\n",
      "            [ 1.9639e+02,  2.7741e+02]],\n",
      "\n",
      "           [[ 2.0439e+02, -3.4586e+01],\n",
      "            [ 2.0439e+02, -2.6586e+01],\n",
      "            [ 2.0439e+02, -1.8586e+01],\n",
      "            ...,\n",
      "            [ 2.0439e+02,  2.6141e+02],\n",
      "            [ 2.0439e+02,  2.6941e+02],\n",
      "            [ 2.0439e+02,  2.7741e+02]],\n",
      "\n",
      "           [[ 2.1239e+02, -3.4586e+01],\n",
      "            [ 2.1239e+02, -2.6586e+01],\n",
      "            [ 2.1239e+02, -1.8586e+01],\n",
      "            ...,\n",
      "            [ 2.1239e+02,  2.6141e+02],\n",
      "            [ 2.1239e+02,  2.6941e+02],\n",
      "            [ 2.1239e+02,  2.7741e+02]]],\n",
      "\n",
      "\n",
      "          [[[-1.9610e+01, -4.1067e+01],\n",
      "            [-1.9610e+01, -3.3067e+01],\n",
      "            [-1.9610e+01, -2.5067e+01],\n",
      "            ...,\n",
      "            [-1.9610e+01,  2.5493e+02],\n",
      "            [-1.9610e+01,  2.6293e+02],\n",
      "            [-1.9610e+01,  2.7093e+02]],\n",
      "\n",
      "           [[-1.1610e+01, -4.1067e+01],\n",
      "            [-1.1610e+01, -3.3067e+01],\n",
      "            [-1.1610e+01, -2.5067e+01],\n",
      "            ...,\n",
      "            [-1.1610e+01,  2.5493e+02],\n",
      "            [-1.1610e+01,  2.6293e+02],\n",
      "            [-1.1610e+01,  2.7093e+02]],\n",
      "\n",
      "           [[-3.6101e+00, -4.1067e+01],\n",
      "            [-3.6101e+00, -3.3067e+01],\n",
      "            [-3.6101e+00, -2.5067e+01],\n",
      "            ...,\n",
      "            [-3.6101e+00,  2.5493e+02],\n",
      "            [-3.6101e+00,  2.6293e+02],\n",
      "            [-3.6101e+00,  2.7093e+02]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 1.9639e+02, -4.1067e+01],\n",
      "            [ 1.9639e+02, -3.3067e+01],\n",
      "            [ 1.9639e+02, -2.5067e+01],\n",
      "            ...,\n",
      "            [ 1.9639e+02,  2.5493e+02],\n",
      "            [ 1.9639e+02,  2.6293e+02],\n",
      "            [ 1.9639e+02,  2.7093e+02]],\n",
      "\n",
      "           [[ 2.0439e+02, -4.1067e+01],\n",
      "            [ 2.0439e+02, -3.3067e+01],\n",
      "            [ 2.0439e+02, -2.5067e+01],\n",
      "            ...,\n",
      "            [ 2.0439e+02,  2.5493e+02],\n",
      "            [ 2.0439e+02,  2.6293e+02],\n",
      "            [ 2.0439e+02,  2.7093e+02]],\n",
      "\n",
      "           [[ 2.1239e+02, -4.1067e+01],\n",
      "            [ 2.1239e+02, -3.3067e+01],\n",
      "            [ 2.1239e+02, -2.5067e+01],\n",
      "            ...,\n",
      "            [ 2.1239e+02,  2.5493e+02],\n",
      "            [ 2.1239e+02,  2.6293e+02],\n",
      "            [ 2.1239e+02,  2.7093e+02]]],\n",
      "\n",
      "\n",
      "          [[[-1.9608e+01, -4.7539e+01],\n",
      "            [-1.9608e+01, -3.9539e+01],\n",
      "            [-1.9608e+01, -3.1539e+01],\n",
      "            ...,\n",
      "            [-1.9608e+01,  2.4846e+02],\n",
      "            [-1.9608e+01,  2.5646e+02],\n",
      "            [-1.9608e+01,  2.6446e+02]],\n",
      "\n",
      "           [[-1.1608e+01, -4.7539e+01],\n",
      "            [-1.1608e+01, -3.9539e+01],\n",
      "            [-1.1608e+01, -3.1539e+01],\n",
      "            ...,\n",
      "            [-1.1608e+01,  2.4846e+02],\n",
      "            [-1.1608e+01,  2.5646e+02],\n",
      "            [-1.1608e+01,  2.6446e+02]],\n",
      "\n",
      "           [[-3.6083e+00, -4.7539e+01],\n",
      "            [-3.6083e+00, -3.9539e+01],\n",
      "            [-3.6083e+00, -3.1539e+01],\n",
      "            ...,\n",
      "            [-3.6083e+00,  2.4846e+02],\n",
      "            [-3.6083e+00,  2.5646e+02],\n",
      "            [-3.6083e+00,  2.6446e+02]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 1.9639e+02, -4.7539e+01],\n",
      "            [ 1.9639e+02, -3.9539e+01],\n",
      "            [ 1.9639e+02, -3.1539e+01],\n",
      "            ...,\n",
      "            [ 1.9639e+02,  2.4846e+02],\n",
      "            [ 1.9639e+02,  2.5646e+02],\n",
      "            [ 1.9639e+02,  2.6446e+02]],\n",
      "\n",
      "           [[ 2.0439e+02, -4.7539e+01],\n",
      "            [ 2.0439e+02, -3.9539e+01],\n",
      "            [ 2.0439e+02, -3.1539e+01],\n",
      "            ...,\n",
      "            [ 2.0439e+02,  2.4846e+02],\n",
      "            [ 2.0439e+02,  2.5646e+02],\n",
      "            [ 2.0439e+02,  2.6446e+02]],\n",
      "\n",
      "           [[ 2.1239e+02, -4.7539e+01],\n",
      "            [ 2.1239e+02, -3.9539e+01],\n",
      "            [ 2.1239e+02, -3.1539e+01],\n",
      "            ...,\n",
      "            [ 2.1239e+02,  2.4846e+02],\n",
      "            [ 2.1239e+02,  2.5646e+02],\n",
      "            [ 2.1239e+02,  2.6446e+02]]],\n",
      "\n",
      "\n",
      "          ...,\n",
      "\n",
      "\n",
      "          [[[-1.9544e+01, -2.6808e+02],\n",
      "            [-1.9544e+01, -2.6008e+02],\n",
      "            [-1.9544e+01, -2.5208e+02],\n",
      "            ...,\n",
      "            [-1.9544e+01,  2.7924e+01],\n",
      "            [-1.9544e+01,  3.5924e+01],\n",
      "            [-1.9544e+01,  4.3924e+01]],\n",
      "\n",
      "           [[-1.1544e+01, -2.6808e+02],\n",
      "            [-1.1544e+01, -2.6008e+02],\n",
      "            [-1.1544e+01, -2.5208e+02],\n",
      "            ...,\n",
      "            [-1.1544e+01,  2.7924e+01],\n",
      "            [-1.1544e+01,  3.5924e+01],\n",
      "            [-1.1544e+01,  4.3924e+01]],\n",
      "\n",
      "           [[-3.5441e+00, -2.6808e+02],\n",
      "            [-3.5441e+00, -2.6008e+02],\n",
      "            [-3.5441e+00, -2.5208e+02],\n",
      "            ...,\n",
      "            [-3.5441e+00,  2.7924e+01],\n",
      "            [-3.5441e+00,  3.5924e+01],\n",
      "            [-3.5441e+00,  4.3924e+01]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 1.9646e+02, -2.6808e+02],\n",
      "            [ 1.9646e+02, -2.6008e+02],\n",
      "            [ 1.9646e+02, -2.5208e+02],\n",
      "            ...,\n",
      "            [ 1.9646e+02,  2.7924e+01],\n",
      "            [ 1.9646e+02,  3.5924e+01],\n",
      "            [ 1.9646e+02,  4.3924e+01]],\n",
      "\n",
      "           [[ 2.0446e+02, -2.6808e+02],\n",
      "            [ 2.0446e+02, -2.6008e+02],\n",
      "            [ 2.0446e+02, -2.5208e+02],\n",
      "            ...,\n",
      "            [ 2.0446e+02,  2.7924e+01],\n",
      "            [ 2.0446e+02,  3.5924e+01],\n",
      "            [ 2.0446e+02,  4.3924e+01]],\n",
      "\n",
      "           [[ 2.1246e+02, -2.6808e+02],\n",
      "            [ 2.1246e+02, -2.6008e+02],\n",
      "            [ 2.1246e+02, -2.5208e+02],\n",
      "            ...,\n",
      "            [ 2.1246e+02,  2.7924e+01],\n",
      "            [ 2.1246e+02,  3.5924e+01],\n",
      "            [ 2.1246e+02,  4.3924e+01]]],\n",
      "\n",
      "\n",
      "          [[[-1.9542e+01, -2.7421e+02],\n",
      "            [-1.9542e+01, -2.6621e+02],\n",
      "            [-1.9542e+01, -2.5821e+02],\n",
      "            ...,\n",
      "            [-1.9542e+01,  2.1788e+01],\n",
      "            [-1.9542e+01,  2.9788e+01],\n",
      "            [-1.9542e+01,  3.7788e+01]],\n",
      "\n",
      "           [[-1.1542e+01, -2.7421e+02],\n",
      "            [-1.1542e+01, -2.6621e+02],\n",
      "            [-1.1542e+01, -2.5821e+02],\n",
      "            ...,\n",
      "            [-1.1542e+01,  2.1788e+01],\n",
      "            [-1.1542e+01,  2.9788e+01],\n",
      "            [-1.1542e+01,  3.7788e+01]],\n",
      "\n",
      "           [[-3.5424e+00, -2.7421e+02],\n",
      "            [-3.5424e+00, -2.6621e+02],\n",
      "            [-3.5424e+00, -2.5821e+02],\n",
      "            ...,\n",
      "            [-3.5424e+00,  2.1788e+01],\n",
      "            [-3.5424e+00,  2.9788e+01],\n",
      "            [-3.5424e+00,  3.7788e+01]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 1.9646e+02, -2.7421e+02],\n",
      "            [ 1.9646e+02, -2.6621e+02],\n",
      "            [ 1.9646e+02, -2.5821e+02],\n",
      "            ...,\n",
      "            [ 1.9646e+02,  2.1788e+01],\n",
      "            [ 1.9646e+02,  2.9788e+01],\n",
      "            [ 1.9646e+02,  3.7788e+01]],\n",
      "\n",
      "           [[ 2.0446e+02, -2.7421e+02],\n",
      "            [ 2.0446e+02, -2.6621e+02],\n",
      "            [ 2.0446e+02, -2.5821e+02],\n",
      "            ...,\n",
      "            [ 2.0446e+02,  2.1788e+01],\n",
      "            [ 2.0446e+02,  2.9788e+01],\n",
      "            [ 2.0446e+02,  3.7788e+01]],\n",
      "\n",
      "           [[ 2.1246e+02, -2.7421e+02],\n",
      "            [ 2.1246e+02, -2.6621e+02],\n",
      "            [ 2.1246e+02, -2.5821e+02],\n",
      "            ...,\n",
      "            [ 2.1246e+02,  2.1788e+01],\n",
      "            [ 2.1246e+02,  2.9788e+01],\n",
      "            [ 2.1246e+02,  3.7788e+01]]],\n",
      "\n",
      "\n",
      "          [[[-1.9541e+01, -2.8034e+02],\n",
      "            [-1.9541e+01, -2.7234e+02],\n",
      "            [-1.9541e+01, -2.6434e+02],\n",
      "            ...,\n",
      "            [-1.9541e+01,  1.5662e+01],\n",
      "            [-1.9541e+01,  2.3662e+01],\n",
      "            [-1.9541e+01,  3.1662e+01]],\n",
      "\n",
      "           [[-1.1541e+01, -2.8034e+02],\n",
      "            [-1.1541e+01, -2.7234e+02],\n",
      "            [-1.1541e+01, -2.6434e+02],\n",
      "            ...,\n",
      "            [-1.1541e+01,  1.5662e+01],\n",
      "            [-1.1541e+01,  2.3662e+01],\n",
      "            [-1.1541e+01,  3.1662e+01]],\n",
      "\n",
      "           [[-3.5406e+00, -2.8034e+02],\n",
      "            [-3.5406e+00, -2.7234e+02],\n",
      "            [-3.5406e+00, -2.6434e+02],\n",
      "            ...,\n",
      "            [-3.5406e+00,  1.5662e+01],\n",
      "            [-3.5406e+00,  2.3662e+01],\n",
      "            [-3.5406e+00,  3.1662e+01]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 1.9646e+02, -2.8034e+02],\n",
      "            [ 1.9646e+02, -2.7234e+02],\n",
      "            [ 1.9646e+02, -2.6434e+02],\n",
      "            ...,\n",
      "            [ 1.9646e+02,  1.5662e+01],\n",
      "            [ 1.9646e+02,  2.3662e+01],\n",
      "            [ 1.9646e+02,  3.1662e+01]],\n",
      "\n",
      "           [[ 2.0446e+02, -2.8034e+02],\n",
      "            [ 2.0446e+02, -2.7234e+02],\n",
      "            [ 2.0446e+02, -2.6434e+02],\n",
      "            ...,\n",
      "            [ 2.0446e+02,  1.5662e+01],\n",
      "            [ 2.0446e+02,  2.3662e+01],\n",
      "            [ 2.0446e+02,  3.1662e+01]],\n",
      "\n",
      "           [[ 2.1246e+02, -2.8034e+02],\n",
      "            [ 2.1246e+02, -2.7234e+02],\n",
      "            [ 2.1246e+02, -2.6434e+02],\n",
      "            ...,\n",
      "            [ 2.1246e+02,  1.5662e+01],\n",
      "            [ 2.1246e+02,  2.3662e+01],\n",
      "            [ 2.1246e+02,  3.1662e+01]]]],\n",
      "\n",
      "\n",
      "\n",
      "         ...,\n",
      "\n",
      "\n",
      "\n",
      "         [[[[-2.0603e+02, -2.2228e+01],\n",
      "            [-2.0603e+02, -1.4228e+01],\n",
      "            [-2.0603e+02, -6.2279e+00],\n",
      "            ...,\n",
      "            [-2.0603e+02,  2.7377e+02],\n",
      "            [-2.0603e+02,  2.8177e+02],\n",
      "            [-2.0603e+02,  2.8977e+02]],\n",
      "\n",
      "           [[-1.9803e+02, -2.2228e+01],\n",
      "            [-1.9803e+02, -1.4228e+01],\n",
      "            [-1.9803e+02, -6.2279e+00],\n",
      "            ...,\n",
      "            [-1.9803e+02,  2.7377e+02],\n",
      "            [-1.9803e+02,  2.8177e+02],\n",
      "            [-1.9803e+02,  2.8977e+02]],\n",
      "\n",
      "           [[-1.9003e+02, -2.2228e+01],\n",
      "            [-1.9003e+02, -1.4228e+01],\n",
      "            [-1.9003e+02, -6.2279e+00],\n",
      "            ...,\n",
      "            [-1.9003e+02,  2.7377e+02],\n",
      "            [-1.9003e+02,  2.8177e+02],\n",
      "            [-1.9003e+02,  2.8977e+02]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 9.9652e+00, -2.2228e+01],\n",
      "            [ 9.9652e+00, -1.4228e+01],\n",
      "            [ 9.9652e+00, -6.2279e+00],\n",
      "            ...,\n",
      "            [ 9.9652e+00,  2.7377e+02],\n",
      "            [ 9.9652e+00,  2.8177e+02],\n",
      "            [ 9.9652e+00,  2.8977e+02]],\n",
      "\n",
      "           [[ 1.7965e+01, -2.2228e+01],\n",
      "            [ 1.7965e+01, -1.4228e+01],\n",
      "            [ 1.7965e+01, -6.2279e+00],\n",
      "            ...,\n",
      "            [ 1.7965e+01,  2.7377e+02],\n",
      "            [ 1.7965e+01,  2.8177e+02],\n",
      "            [ 1.7965e+01,  2.8977e+02]],\n",
      "\n",
      "           [[ 2.5965e+01, -2.2228e+01],\n",
      "            [ 2.5965e+01, -1.4228e+01],\n",
      "            [ 2.5965e+01, -6.2279e+00],\n",
      "            ...,\n",
      "            [ 2.5965e+01,  2.7377e+02],\n",
      "            [ 2.5965e+01,  2.8177e+02],\n",
      "            [ 2.5965e+01,  2.8977e+02]]],\n",
      "\n",
      "\n",
      "          [[[-2.0589e+02, -2.9007e+01],\n",
      "            [-2.0589e+02, -2.1007e+01],\n",
      "            [-2.0589e+02, -1.3007e+01],\n",
      "            ...,\n",
      "            [-2.0589e+02,  2.6699e+02],\n",
      "            [-2.0589e+02,  2.7499e+02],\n",
      "            [-2.0589e+02,  2.8299e+02]],\n",
      "\n",
      "           [[-1.9789e+02, -2.9007e+01],\n",
      "            [-1.9789e+02, -2.1007e+01],\n",
      "            [-1.9789e+02, -1.3007e+01],\n",
      "            ...,\n",
      "            [-1.9789e+02,  2.6699e+02],\n",
      "            [-1.9789e+02,  2.7499e+02],\n",
      "            [-1.9789e+02,  2.8299e+02]],\n",
      "\n",
      "           [[-1.8989e+02, -2.9007e+01],\n",
      "            [-1.8989e+02, -2.1007e+01],\n",
      "            [-1.8989e+02, -1.3007e+01],\n",
      "            ...,\n",
      "            [-1.8989e+02,  2.6699e+02],\n",
      "            [-1.8989e+02,  2.7499e+02],\n",
      "            [-1.8989e+02,  2.8299e+02]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 1.0113e+01, -2.9007e+01],\n",
      "            [ 1.0113e+01, -2.1007e+01],\n",
      "            [ 1.0113e+01, -1.3007e+01],\n",
      "            ...,\n",
      "            [ 1.0113e+01,  2.6699e+02],\n",
      "            [ 1.0113e+01,  2.7499e+02],\n",
      "            [ 1.0113e+01,  2.8299e+02]],\n",
      "\n",
      "           [[ 1.8113e+01, -2.9007e+01],\n",
      "            [ 1.8113e+01, -2.1007e+01],\n",
      "            [ 1.8113e+01, -1.3007e+01],\n",
      "            ...,\n",
      "            [ 1.8113e+01,  2.6699e+02],\n",
      "            [ 1.8113e+01,  2.7499e+02],\n",
      "            [ 1.8113e+01,  2.8299e+02]],\n",
      "\n",
      "           [[ 2.6113e+01, -2.9007e+01],\n",
      "            [ 2.6113e+01, -2.1007e+01],\n",
      "            [ 2.6113e+01, -1.3007e+01],\n",
      "            ...,\n",
      "            [ 2.6113e+01,  2.6699e+02],\n",
      "            [ 2.6113e+01,  2.7499e+02],\n",
      "            [ 2.6113e+01,  2.8299e+02]]],\n",
      "\n",
      "\n",
      "          [[[-2.0574e+02, -3.5776e+01],\n",
      "            [-2.0574e+02, -2.7776e+01],\n",
      "            [-2.0574e+02, -1.9776e+01],\n",
      "            ...,\n",
      "            [-2.0574e+02,  2.6022e+02],\n",
      "            [-2.0574e+02,  2.6822e+02],\n",
      "            [-2.0574e+02,  2.7622e+02]],\n",
      "\n",
      "           [[-1.9774e+02, -3.5776e+01],\n",
      "            [-1.9774e+02, -2.7776e+01],\n",
      "            [-1.9774e+02, -1.9776e+01],\n",
      "            ...,\n",
      "            [-1.9774e+02,  2.6022e+02],\n",
      "            [-1.9774e+02,  2.6822e+02],\n",
      "            [-1.9774e+02,  2.7622e+02]],\n",
      "\n",
      "           [[-1.8974e+02, -3.5776e+01],\n",
      "            [-1.8974e+02, -2.7776e+01],\n",
      "            [-1.8974e+02, -1.9776e+01],\n",
      "            ...,\n",
      "            [-1.8974e+02,  2.6022e+02],\n",
      "            [-1.8974e+02,  2.6822e+02],\n",
      "            [-1.8974e+02,  2.7622e+02]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 1.0261e+01, -3.5776e+01],\n",
      "            [ 1.0261e+01, -2.7776e+01],\n",
      "            [ 1.0261e+01, -1.9776e+01],\n",
      "            ...,\n",
      "            [ 1.0261e+01,  2.6022e+02],\n",
      "            [ 1.0261e+01,  2.6822e+02],\n",
      "            [ 1.0261e+01,  2.7622e+02]],\n",
      "\n",
      "           [[ 1.8261e+01, -3.5776e+01],\n",
      "            [ 1.8261e+01, -2.7776e+01],\n",
      "            [ 1.8261e+01, -1.9776e+01],\n",
      "            ...,\n",
      "            [ 1.8261e+01,  2.6022e+02],\n",
      "            [ 1.8261e+01,  2.6822e+02],\n",
      "            [ 1.8261e+01,  2.7622e+02]],\n",
      "\n",
      "           [[ 2.6261e+01, -3.5776e+01],\n",
      "            [ 2.6261e+01, -2.7776e+01],\n",
      "            [ 2.6261e+01, -1.9776e+01],\n",
      "            ...,\n",
      "            [ 2.6261e+01,  2.6022e+02],\n",
      "            [ 2.6261e+01,  2.6822e+02],\n",
      "            [ 2.6261e+01,  2.7622e+02]]],\n",
      "\n",
      "\n",
      "          ...,\n",
      "\n",
      "\n",
      "          [[[-2.0070e+02, -2.6617e+02],\n",
      "            [-2.0070e+02, -2.5817e+02],\n",
      "            [-2.0070e+02, -2.5017e+02],\n",
      "            ...,\n",
      "            [-2.0070e+02,  2.9828e+01],\n",
      "            [-2.0070e+02,  3.7828e+01],\n",
      "            [-2.0070e+02,  4.5828e+01]],\n",
      "\n",
      "           [[-1.9270e+02, -2.6617e+02],\n",
      "            [-1.9270e+02, -2.5817e+02],\n",
      "            [-1.9270e+02, -2.5017e+02],\n",
      "            ...,\n",
      "            [-1.9270e+02,  2.9828e+01],\n",
      "            [-1.9270e+02,  3.7828e+01],\n",
      "            [-1.9270e+02,  4.5828e+01]],\n",
      "\n",
      "           [[-1.8470e+02, -2.6617e+02],\n",
      "            [-1.8470e+02, -2.5817e+02],\n",
      "            [-1.8470e+02, -2.5017e+02],\n",
      "            ...,\n",
      "            [-1.8470e+02,  2.9828e+01],\n",
      "            [-1.8470e+02,  3.7828e+01],\n",
      "            [-1.8470e+02,  4.5828e+01]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 1.5297e+01, -2.6617e+02],\n",
      "            [ 1.5297e+01, -2.5817e+02],\n",
      "            [ 1.5297e+01, -2.5017e+02],\n",
      "            ...,\n",
      "            [ 1.5297e+01,  2.9828e+01],\n",
      "            [ 1.5297e+01,  3.7828e+01],\n",
      "            [ 1.5297e+01,  4.5828e+01]],\n",
      "\n",
      "           [[ 2.3297e+01, -2.6617e+02],\n",
      "            [ 2.3297e+01, -2.5817e+02],\n",
      "            [ 2.3297e+01, -2.5017e+02],\n",
      "            ...,\n",
      "            [ 2.3297e+01,  2.9828e+01],\n",
      "            [ 2.3297e+01,  3.7828e+01],\n",
      "            [ 2.3297e+01,  4.5828e+01]],\n",
      "\n",
      "           [[ 3.1297e+01, -2.6617e+02],\n",
      "            [ 3.1297e+01, -2.5817e+02],\n",
      "            [ 3.1297e+01, -2.5017e+02],\n",
      "            ...,\n",
      "            [ 3.1297e+01,  2.9828e+01],\n",
      "            [ 3.1297e+01,  3.7828e+01],\n",
      "            [ 3.1297e+01,  4.5828e+01]]],\n",
      "\n",
      "\n",
      "          [[[-2.0056e+02, -2.7257e+02],\n",
      "            [-2.0056e+02, -2.6457e+02],\n",
      "            [-2.0056e+02, -2.5657e+02],\n",
      "            ...,\n",
      "            [-2.0056e+02,  2.3426e+01],\n",
      "            [-2.0056e+02,  3.1426e+01],\n",
      "            [-2.0056e+02,  3.9426e+01]],\n",
      "\n",
      "           [[-1.9256e+02, -2.7257e+02],\n",
      "            [-1.9256e+02, -2.6457e+02],\n",
      "            [-1.9256e+02, -2.5657e+02],\n",
      "            ...,\n",
      "            [-1.9256e+02,  2.3426e+01],\n",
      "            [-1.9256e+02,  3.1426e+01],\n",
      "            [-1.9256e+02,  3.9426e+01]],\n",
      "\n",
      "           [[-1.8456e+02, -2.7257e+02],\n",
      "            [-1.8456e+02, -2.6457e+02],\n",
      "            [-1.8456e+02, -2.5657e+02],\n",
      "            ...,\n",
      "            [-1.8456e+02,  2.3426e+01],\n",
      "            [-1.8456e+02,  3.1426e+01],\n",
      "            [-1.8456e+02,  3.9426e+01]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 1.5437e+01, -2.7257e+02],\n",
      "            [ 1.5437e+01, -2.6457e+02],\n",
      "            [ 1.5437e+01, -2.5657e+02],\n",
      "            ...,\n",
      "            [ 1.5437e+01,  2.3426e+01],\n",
      "            [ 1.5437e+01,  3.1426e+01],\n",
      "            [ 1.5437e+01,  3.9426e+01]],\n",
      "\n",
      "           [[ 2.3437e+01, -2.7257e+02],\n",
      "            [ 2.3437e+01, -2.6457e+02],\n",
      "            [ 2.3437e+01, -2.5657e+02],\n",
      "            ...,\n",
      "            [ 2.3437e+01,  2.3426e+01],\n",
      "            [ 2.3437e+01,  3.1426e+01],\n",
      "            [ 2.3437e+01,  3.9426e+01]],\n",
      "\n",
      "           [[ 3.1437e+01, -2.7257e+02],\n",
      "            [ 3.1437e+01, -2.6457e+02],\n",
      "            [ 3.1437e+01, -2.5657e+02],\n",
      "            ...,\n",
      "            [ 3.1437e+01,  2.3426e+01],\n",
      "            [ 3.1437e+01,  3.1426e+01],\n",
      "            [ 3.1437e+01,  3.9426e+01]]],\n",
      "\n",
      "\n",
      "          [[[-2.0042e+02, -2.7897e+02],\n",
      "            [-2.0042e+02, -2.7097e+02],\n",
      "            [-2.0042e+02, -2.6297e+02],\n",
      "            ...,\n",
      "            [-2.0042e+02,  1.7034e+01],\n",
      "            [-2.0042e+02,  2.5034e+01],\n",
      "            [-2.0042e+02,  3.3034e+01]],\n",
      "\n",
      "           [[-1.9242e+02, -2.7897e+02],\n",
      "            [-1.9242e+02, -2.7097e+02],\n",
      "            [-1.9242e+02, -2.6297e+02],\n",
      "            ...,\n",
      "            [-1.9242e+02,  1.7034e+01],\n",
      "            [-1.9242e+02,  2.5034e+01],\n",
      "            [-1.9242e+02,  3.3034e+01]],\n",
      "\n",
      "           [[-1.8442e+02, -2.7897e+02],\n",
      "            [-1.8442e+02, -2.7097e+02],\n",
      "            [-1.8442e+02, -2.6297e+02],\n",
      "            ...,\n",
      "            [-1.8442e+02,  1.7034e+01],\n",
      "            [-1.8442e+02,  2.5034e+01],\n",
      "            [-1.8442e+02,  3.3034e+01]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 1.5577e+01, -2.7897e+02],\n",
      "            [ 1.5577e+01, -2.7097e+02],\n",
      "            [ 1.5577e+01, -2.6297e+02],\n",
      "            ...,\n",
      "            [ 1.5577e+01,  1.7034e+01],\n",
      "            [ 1.5577e+01,  2.5034e+01],\n",
      "            [ 1.5577e+01,  3.3034e+01]],\n",
      "\n",
      "           [[ 2.3577e+01, -2.7897e+02],\n",
      "            [ 2.3577e+01, -2.7097e+02],\n",
      "            [ 2.3577e+01, -2.6297e+02],\n",
      "            ...,\n",
      "            [ 2.3577e+01,  1.7034e+01],\n",
      "            [ 2.3577e+01,  2.5034e+01],\n",
      "            [ 2.3577e+01,  3.3034e+01]],\n",
      "\n",
      "           [[ 3.1577e+01, -2.7897e+02],\n",
      "            [ 3.1577e+01, -2.7097e+02],\n",
      "            [ 3.1577e+01, -2.6297e+02],\n",
      "            ...,\n",
      "            [ 3.1577e+01,  1.7034e+01],\n",
      "            [ 3.1577e+01,  2.5034e+01],\n",
      "            [ 3.1577e+01,  3.3034e+01]]]],\n",
      "\n",
      "\n",
      "\n",
      "         [[[[-2.1384e+02, -2.1711e+01],\n",
      "            [-2.1384e+02, -1.3711e+01],\n",
      "            [-2.1384e+02, -5.7106e+00],\n",
      "            ...,\n",
      "            [-2.1384e+02,  2.7429e+02],\n",
      "            [-2.1384e+02,  2.8229e+02],\n",
      "            [-2.1384e+02,  2.9029e+02]],\n",
      "\n",
      "           [[-2.0584e+02, -2.1711e+01],\n",
      "            [-2.0584e+02, -1.3711e+01],\n",
      "            [-2.0584e+02, -5.7106e+00],\n",
      "            ...,\n",
      "            [-2.0584e+02,  2.7429e+02],\n",
      "            [-2.0584e+02,  2.8229e+02],\n",
      "            [-2.0584e+02,  2.9029e+02]],\n",
      "\n",
      "           [[-1.9784e+02, -2.1711e+01],\n",
      "            [-1.9784e+02, -1.3711e+01],\n",
      "            [-1.9784e+02, -5.7106e+00],\n",
      "            ...,\n",
      "            [-1.9784e+02,  2.7429e+02],\n",
      "            [-1.9784e+02,  2.8229e+02],\n",
      "            [-1.9784e+02,  2.9029e+02]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 2.1623e+00, -2.1711e+01],\n",
      "            [ 2.1623e+00, -1.3711e+01],\n",
      "            [ 2.1623e+00, -5.7106e+00],\n",
      "            ...,\n",
      "            [ 2.1623e+00,  2.7429e+02],\n",
      "            [ 2.1623e+00,  2.8229e+02],\n",
      "            [ 2.1623e+00,  2.9029e+02]],\n",
      "\n",
      "           [[ 1.0162e+01, -2.1711e+01],\n",
      "            [ 1.0162e+01, -1.3711e+01],\n",
      "            [ 1.0162e+01, -5.7106e+00],\n",
      "            ...,\n",
      "            [ 1.0162e+01,  2.7429e+02],\n",
      "            [ 1.0162e+01,  2.8229e+02],\n",
      "            [ 1.0162e+01,  2.9029e+02]],\n",
      "\n",
      "           [[ 1.8162e+01, -2.1711e+01],\n",
      "            [ 1.8162e+01, -1.3711e+01],\n",
      "            [ 1.8162e+01, -5.7106e+00],\n",
      "            ...,\n",
      "            [ 1.8162e+01,  2.7429e+02],\n",
      "            [ 1.8162e+01,  2.8229e+02],\n",
      "            [ 1.8162e+01,  2.9029e+02]]],\n",
      "\n",
      "\n",
      "          [[[-2.1368e+02, -2.8502e+01],\n",
      "            [-2.1368e+02, -2.0502e+01],\n",
      "            [-2.1368e+02, -1.2502e+01],\n",
      "            ...,\n",
      "            [-2.1368e+02,  2.6750e+02],\n",
      "            [-2.1368e+02,  2.7550e+02],\n",
      "            [-2.1368e+02,  2.8350e+02]],\n",
      "\n",
      "           [[-2.0568e+02, -2.8502e+01],\n",
      "            [-2.0568e+02, -2.0502e+01],\n",
      "            [-2.0568e+02, -1.2502e+01],\n",
      "            ...,\n",
      "            [-2.0568e+02,  2.6750e+02],\n",
      "            [-2.0568e+02,  2.7550e+02],\n",
      "            [-2.0568e+02,  2.8350e+02]],\n",
      "\n",
      "           [[-1.9768e+02, -2.8502e+01],\n",
      "            [-1.9768e+02, -2.0502e+01],\n",
      "            [-1.9768e+02, -1.2502e+01],\n",
      "            ...,\n",
      "            [-1.9768e+02,  2.6750e+02],\n",
      "            [-1.9768e+02,  2.7550e+02],\n",
      "            [-1.9768e+02,  2.8350e+02]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 2.3169e+00, -2.8502e+01],\n",
      "            [ 2.3169e+00, -2.0502e+01],\n",
      "            [ 2.3169e+00, -1.2502e+01],\n",
      "            ...,\n",
      "            [ 2.3169e+00,  2.6750e+02],\n",
      "            [ 2.3169e+00,  2.7550e+02],\n",
      "            [ 2.3169e+00,  2.8350e+02]],\n",
      "\n",
      "           [[ 1.0317e+01, -2.8502e+01],\n",
      "            [ 1.0317e+01, -2.0502e+01],\n",
      "            [ 1.0317e+01, -1.2502e+01],\n",
      "            ...,\n",
      "            [ 1.0317e+01,  2.6750e+02],\n",
      "            [ 1.0317e+01,  2.7550e+02],\n",
      "            [ 1.0317e+01,  2.8350e+02]],\n",
      "\n",
      "           [[ 1.8317e+01, -2.8502e+01],\n",
      "            [ 1.8317e+01, -2.0502e+01],\n",
      "            [ 1.8317e+01, -1.2502e+01],\n",
      "            ...,\n",
      "            [ 1.8317e+01,  2.6750e+02],\n",
      "            [ 1.8317e+01,  2.7550e+02],\n",
      "            [ 1.8317e+01,  2.8350e+02]]],\n",
      "\n",
      "\n",
      "          [[[-2.1353e+02, -3.5283e+01],\n",
      "            [-2.1353e+02, -2.7283e+01],\n",
      "            [-2.1353e+02, -1.9283e+01],\n",
      "            ...,\n",
      "            [-2.1353e+02,  2.6072e+02],\n",
      "            [-2.1353e+02,  2.6872e+02],\n",
      "            [-2.1353e+02,  2.7672e+02]],\n",
      "\n",
      "           [[-2.0553e+02, -3.5283e+01],\n",
      "            [-2.0553e+02, -2.7283e+01],\n",
      "            [-2.0553e+02, -1.9283e+01],\n",
      "            ...,\n",
      "            [-2.0553e+02,  2.6072e+02],\n",
      "            [-2.0553e+02,  2.6872e+02],\n",
      "            [-2.0553e+02,  2.7672e+02]],\n",
      "\n",
      "           [[-1.9753e+02, -3.5283e+01],\n",
      "            [-1.9753e+02, -2.7283e+01],\n",
      "            [-1.9753e+02, -1.9283e+01],\n",
      "            ...,\n",
      "            [-1.9753e+02,  2.6072e+02],\n",
      "            [-1.9753e+02,  2.6872e+02],\n",
      "            [-1.9753e+02,  2.7672e+02]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 2.4713e+00, -3.5283e+01],\n",
      "            [ 2.4713e+00, -2.7283e+01],\n",
      "            [ 2.4713e+00, -1.9283e+01],\n",
      "            ...,\n",
      "            [ 2.4713e+00,  2.6072e+02],\n",
      "            [ 2.4713e+00,  2.6872e+02],\n",
      "            [ 2.4713e+00,  2.7672e+02]],\n",
      "\n",
      "           [[ 1.0471e+01, -3.5283e+01],\n",
      "            [ 1.0471e+01, -2.7283e+01],\n",
      "            [ 1.0471e+01, -1.9283e+01],\n",
      "            ...,\n",
      "            [ 1.0471e+01,  2.6072e+02],\n",
      "            [ 1.0471e+01,  2.6872e+02],\n",
      "            [ 1.0471e+01,  2.7672e+02]],\n",
      "\n",
      "           [[ 1.8471e+01, -3.5283e+01],\n",
      "            [ 1.8471e+01, -2.7283e+01],\n",
      "            [ 1.8471e+01, -1.9283e+01],\n",
      "            ...,\n",
      "            [ 1.8471e+01,  2.6072e+02],\n",
      "            [ 1.8471e+01,  2.6872e+02],\n",
      "            [ 1.8471e+01,  2.7672e+02]]],\n",
      "\n",
      "\n",
      "          ...,\n",
      "\n",
      "\n",
      "          [[[-2.0828e+02, -2.6609e+02],\n",
      "            [-2.0828e+02, -2.5809e+02],\n",
      "            [-2.0828e+02, -2.5009e+02],\n",
      "            ...,\n",
      "            [-2.0828e+02,  2.9908e+01],\n",
      "            [-2.0828e+02,  3.7908e+01],\n",
      "            [-2.0828e+02,  4.5908e+01]],\n",
      "\n",
      "           [[-2.0028e+02, -2.6609e+02],\n",
      "            [-2.0028e+02, -2.5809e+02],\n",
      "            [-2.0028e+02, -2.5009e+02],\n",
      "            ...,\n",
      "            [-2.0028e+02,  2.9908e+01],\n",
      "            [-2.0028e+02,  3.7908e+01],\n",
      "            [-2.0028e+02,  4.5908e+01]],\n",
      "\n",
      "           [[-1.9228e+02, -2.6609e+02],\n",
      "            [-1.9228e+02, -2.5809e+02],\n",
      "            [-1.9228e+02, -2.5009e+02],\n",
      "            ...,\n",
      "            [-1.9228e+02,  2.9908e+01],\n",
      "            [-1.9228e+02,  3.7908e+01],\n",
      "            [-1.9228e+02,  4.5908e+01]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 7.7241e+00, -2.6609e+02],\n",
      "            [ 7.7241e+00, -2.5809e+02],\n",
      "            [ 7.7241e+00, -2.5009e+02],\n",
      "            ...,\n",
      "            [ 7.7241e+00,  2.9908e+01],\n",
      "            [ 7.7241e+00,  3.7908e+01],\n",
      "            [ 7.7241e+00,  4.5908e+01]],\n",
      "\n",
      "           [[ 1.5724e+01, -2.6609e+02],\n",
      "            [ 1.5724e+01, -2.5809e+02],\n",
      "            [ 1.5724e+01, -2.5009e+02],\n",
      "            ...,\n",
      "            [ 1.5724e+01,  2.9908e+01],\n",
      "            [ 1.5724e+01,  3.7908e+01],\n",
      "            [ 1.5724e+01,  4.5908e+01]],\n",
      "\n",
      "           [[ 2.3724e+01, -2.6609e+02],\n",
      "            [ 2.3724e+01, -2.5809e+02],\n",
      "            [ 2.3724e+01, -2.5009e+02],\n",
      "            ...,\n",
      "            [ 2.3724e+01,  2.9908e+01],\n",
      "            [ 2.3724e+01,  3.7908e+01],\n",
      "            [ 2.3724e+01,  4.5908e+01]]],\n",
      "\n",
      "\n",
      "          [[[-2.0813e+02, -2.7251e+02],\n",
      "            [-2.0813e+02, -2.6451e+02],\n",
      "            [-2.0813e+02, -2.5651e+02],\n",
      "            ...,\n",
      "            [-2.0813e+02,  2.3495e+01],\n",
      "            [-2.0813e+02,  3.1495e+01],\n",
      "            [-2.0813e+02,  3.9495e+01]],\n",
      "\n",
      "           [[-2.0013e+02, -2.7251e+02],\n",
      "            [-2.0013e+02, -2.6451e+02],\n",
      "            [-2.0013e+02, -2.5651e+02],\n",
      "            ...,\n",
      "            [-2.0013e+02,  2.3495e+01],\n",
      "            [-2.0013e+02,  3.1495e+01],\n",
      "            [-2.0013e+02,  3.9495e+01]],\n",
      "\n",
      "           [[-1.9213e+02, -2.7251e+02],\n",
      "            [-1.9213e+02, -2.6451e+02],\n",
      "            [-1.9213e+02, -2.5651e+02],\n",
      "            ...,\n",
      "            [-1.9213e+02,  2.3495e+01],\n",
      "            [-1.9213e+02,  3.1495e+01],\n",
      "            [-1.9213e+02,  3.9495e+01]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 7.8701e+00, -2.7251e+02],\n",
      "            [ 7.8701e+00, -2.6451e+02],\n",
      "            [ 7.8701e+00, -2.5651e+02],\n",
      "            ...,\n",
      "            [ 7.8701e+00,  2.3495e+01],\n",
      "            [ 7.8701e+00,  3.1495e+01],\n",
      "            [ 7.8701e+00,  3.9495e+01]],\n",
      "\n",
      "           [[ 1.5870e+01, -2.7251e+02],\n",
      "            [ 1.5870e+01, -2.6451e+02],\n",
      "            [ 1.5870e+01, -2.5651e+02],\n",
      "            ...,\n",
      "            [ 1.5870e+01,  2.3495e+01],\n",
      "            [ 1.5870e+01,  3.1495e+01],\n",
      "            [ 1.5870e+01,  3.9495e+01]],\n",
      "\n",
      "           [[ 2.3870e+01, -2.7251e+02],\n",
      "            [ 2.3870e+01, -2.6451e+02],\n",
      "            [ 2.3870e+01, -2.5651e+02],\n",
      "            ...,\n",
      "            [ 2.3870e+01,  2.3495e+01],\n",
      "            [ 2.3870e+01,  3.1495e+01],\n",
      "            [ 2.3870e+01,  3.9495e+01]]],\n",
      "\n",
      "\n",
      "          [[[-2.0798e+02, -2.7891e+02],\n",
      "            [-2.0798e+02, -2.7091e+02],\n",
      "            [-2.0798e+02, -2.6291e+02],\n",
      "            ...,\n",
      "            [-2.0798e+02,  1.7091e+01],\n",
      "            [-2.0798e+02,  2.5091e+01],\n",
      "            [-2.0798e+02,  3.3091e+01]],\n",
      "\n",
      "           [[-1.9998e+02, -2.7891e+02],\n",
      "            [-1.9998e+02, -2.7091e+02],\n",
      "            [-1.9998e+02, -2.6291e+02],\n",
      "            ...,\n",
      "            [-1.9998e+02,  1.7091e+01],\n",
      "            [-1.9998e+02,  2.5091e+01],\n",
      "            [-1.9998e+02,  3.3091e+01]],\n",
      "\n",
      "           [[-1.9198e+02, -2.7891e+02],\n",
      "            [-1.9198e+02, -2.7091e+02],\n",
      "            [-1.9198e+02, -2.6291e+02],\n",
      "            ...,\n",
      "            [-1.9198e+02,  1.7091e+01],\n",
      "            [-1.9198e+02,  2.5091e+01],\n",
      "            [-1.9198e+02,  3.3091e+01]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 8.0158e+00, -2.7891e+02],\n",
      "            [ 8.0158e+00, -2.7091e+02],\n",
      "            [ 8.0158e+00, -2.6291e+02],\n",
      "            ...,\n",
      "            [ 8.0158e+00,  1.7091e+01],\n",
      "            [ 8.0158e+00,  2.5091e+01],\n",
      "            [ 8.0158e+00,  3.3091e+01]],\n",
      "\n",
      "           [[ 1.6016e+01, -2.7891e+02],\n",
      "            [ 1.6016e+01, -2.7091e+02],\n",
      "            [ 1.6016e+01, -2.6291e+02],\n",
      "            ...,\n",
      "            [ 1.6016e+01,  1.7091e+01],\n",
      "            [ 1.6016e+01,  2.5091e+01],\n",
      "            [ 1.6016e+01,  3.3091e+01]],\n",
      "\n",
      "           [[ 2.4016e+01, -2.7891e+02],\n",
      "            [ 2.4016e+01, -2.7091e+02],\n",
      "            [ 2.4016e+01, -2.6291e+02],\n",
      "            ...,\n",
      "            [ 2.4016e+01,  1.7091e+01],\n",
      "            [ 2.4016e+01,  2.5091e+01],\n",
      "            [ 2.4016e+01,  3.3091e+01]]]],\n",
      "\n",
      "\n",
      "\n",
      "         [[[[-2.2167e+02, -2.1191e+01],\n",
      "            [-2.2167e+02, -1.3191e+01],\n",
      "            [-2.2167e+02, -5.1915e+00],\n",
      "            ...,\n",
      "            [-2.2167e+02,  2.7481e+02],\n",
      "            [-2.2167e+02,  2.8281e+02],\n",
      "            [-2.2167e+02,  2.9081e+02]],\n",
      "\n",
      "           [[-2.1367e+02, -2.1191e+01],\n",
      "            [-2.1367e+02, -1.3191e+01],\n",
      "            [-2.1367e+02, -5.1915e+00],\n",
      "            ...,\n",
      "            [-2.1367e+02,  2.7481e+02],\n",
      "            [-2.1367e+02,  2.8281e+02],\n",
      "            [-2.1367e+02,  2.9081e+02]],\n",
      "\n",
      "           [[-2.0567e+02, -2.1191e+01],\n",
      "            [-2.0567e+02, -1.3191e+01],\n",
      "            [-2.0567e+02, -5.1915e+00],\n",
      "            ...,\n",
      "            [-2.0567e+02,  2.7481e+02],\n",
      "            [-2.0567e+02,  2.8281e+02],\n",
      "            [-2.0567e+02,  2.9081e+02]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[-5.6685e+00, -2.1191e+01],\n",
      "            [-5.6685e+00, -1.3191e+01],\n",
      "            [-5.6685e+00, -5.1915e+00],\n",
      "            ...,\n",
      "            [-5.6685e+00,  2.7481e+02],\n",
      "            [-5.6685e+00,  2.8281e+02],\n",
      "            [-5.6685e+00,  2.9081e+02]],\n",
      "\n",
      "           [[ 2.3315e+00, -2.1191e+01],\n",
      "            [ 2.3315e+00, -1.3191e+01],\n",
      "            [ 2.3315e+00, -5.1915e+00],\n",
      "            ...,\n",
      "            [ 2.3315e+00,  2.7481e+02],\n",
      "            [ 2.3315e+00,  2.8281e+02],\n",
      "            [ 2.3315e+00,  2.9081e+02]],\n",
      "\n",
      "           [[ 1.0332e+01, -2.1191e+01],\n",
      "            [ 1.0332e+01, -1.3191e+01],\n",
      "            [ 1.0332e+01, -5.1915e+00],\n",
      "            ...,\n",
      "            [ 1.0332e+01,  2.7481e+02],\n",
      "            [ 1.0332e+01,  2.8281e+02],\n",
      "            [ 1.0332e+01,  2.9081e+02]]],\n",
      "\n",
      "\n",
      "          [[[-2.2151e+02, -2.7996e+01],\n",
      "            [-2.2151e+02, -1.9996e+01],\n",
      "            [-2.2151e+02, -1.1996e+01],\n",
      "            ...,\n",
      "            [-2.2151e+02,  2.6800e+02],\n",
      "            [-2.2151e+02,  2.7600e+02],\n",
      "            [-2.2151e+02,  2.8400e+02]],\n",
      "\n",
      "           [[-2.1351e+02, -2.7996e+01],\n",
      "            [-2.1351e+02, -1.9996e+01],\n",
      "            [-2.1351e+02, -1.1996e+01],\n",
      "            ...,\n",
      "            [-2.1351e+02,  2.6800e+02],\n",
      "            [-2.1351e+02,  2.7600e+02],\n",
      "            [-2.1351e+02,  2.8400e+02]],\n",
      "\n",
      "           [[-2.0551e+02, -2.7996e+01],\n",
      "            [-2.0551e+02, -1.9996e+01],\n",
      "            [-2.0551e+02, -1.1996e+01],\n",
      "            ...,\n",
      "            [-2.0551e+02,  2.6800e+02],\n",
      "            [-2.0551e+02,  2.7600e+02],\n",
      "            [-2.0551e+02,  2.8400e+02]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[-5.5074e+00, -2.7996e+01],\n",
      "            [-5.5074e+00, -1.9996e+01],\n",
      "            [-5.5074e+00, -1.1996e+01],\n",
      "            ...,\n",
      "            [-5.5074e+00,  2.6800e+02],\n",
      "            [-5.5074e+00,  2.7600e+02],\n",
      "            [-5.5074e+00,  2.8400e+02]],\n",
      "\n",
      "           [[ 2.4926e+00, -2.7996e+01],\n",
      "            [ 2.4926e+00, -1.9996e+01],\n",
      "            [ 2.4926e+00, -1.1996e+01],\n",
      "            ...,\n",
      "            [ 2.4926e+00,  2.6800e+02],\n",
      "            [ 2.4926e+00,  2.7600e+02],\n",
      "            [ 2.4926e+00,  2.8400e+02]],\n",
      "\n",
      "           [[ 1.0493e+01, -2.7996e+01],\n",
      "            [ 1.0493e+01, -1.9996e+01],\n",
      "            [ 1.0493e+01, -1.1996e+01],\n",
      "            ...,\n",
      "            [ 1.0493e+01,  2.6800e+02],\n",
      "            [ 1.0493e+01,  2.7600e+02],\n",
      "            [ 1.0493e+01,  2.8400e+02]]],\n",
      "\n",
      "\n",
      "          [[[-2.2135e+02, -3.4789e+01],\n",
      "            [-2.2135e+02, -2.6789e+01],\n",
      "            [-2.2135e+02, -1.8789e+01],\n",
      "            ...,\n",
      "            [-2.2135e+02,  2.6121e+02],\n",
      "            [-2.2135e+02,  2.6921e+02],\n",
      "            [-2.2135e+02,  2.7721e+02]],\n",
      "\n",
      "           [[-2.1335e+02, -3.4789e+01],\n",
      "            [-2.1335e+02, -2.6789e+01],\n",
      "            [-2.1335e+02, -1.8789e+01],\n",
      "            ...,\n",
      "            [-2.1335e+02,  2.6121e+02],\n",
      "            [-2.1335e+02,  2.6921e+02],\n",
      "            [-2.1335e+02,  2.7721e+02]],\n",
      "\n",
      "           [[-2.0535e+02, -3.4789e+01],\n",
      "            [-2.0535e+02, -2.6789e+01],\n",
      "            [-2.0535e+02, -1.8789e+01],\n",
      "            ...,\n",
      "            [-2.0535e+02,  2.6121e+02],\n",
      "            [-2.0535e+02,  2.6921e+02],\n",
      "            [-2.0535e+02,  2.7721e+02]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[-5.3467e+00, -3.4789e+01],\n",
      "            [-5.3467e+00, -2.6789e+01],\n",
      "            [-5.3467e+00, -1.8789e+01],\n",
      "            ...,\n",
      "            [-5.3467e+00,  2.6121e+02],\n",
      "            [-5.3467e+00,  2.6921e+02],\n",
      "            [-5.3467e+00,  2.7721e+02]],\n",
      "\n",
      "           [[ 2.6533e+00, -3.4789e+01],\n",
      "            [ 2.6533e+00, -2.6789e+01],\n",
      "            [ 2.6533e+00, -1.8789e+01],\n",
      "            ...,\n",
      "            [ 2.6533e+00,  2.6121e+02],\n",
      "            [ 2.6533e+00,  2.6921e+02],\n",
      "            [ 2.6533e+00,  2.7721e+02]],\n",
      "\n",
      "           [[ 1.0653e+01, -3.4789e+01],\n",
      "            [ 1.0653e+01, -2.6789e+01],\n",
      "            [ 1.0653e+01, -1.8789e+01],\n",
      "            ...,\n",
      "            [ 1.0653e+01,  2.6121e+02],\n",
      "            [ 1.0653e+01,  2.6921e+02],\n",
      "            [ 1.0653e+01,  2.7721e+02]]],\n",
      "\n",
      "\n",
      "          ...,\n",
      "\n",
      "\n",
      "          [[[-2.1588e+02, -2.6601e+02],\n",
      "            [-2.1588e+02, -2.5801e+02],\n",
      "            [-2.1588e+02, -2.5001e+02],\n",
      "            ...,\n",
      "            [-2.1588e+02,  2.9988e+01],\n",
      "            [-2.1588e+02,  3.7988e+01],\n",
      "            [-2.1588e+02,  4.5988e+01]],\n",
      "\n",
      "           [[-2.0788e+02, -2.6601e+02],\n",
      "            [-2.0788e+02, -2.5801e+02],\n",
      "            [-2.0788e+02, -2.5001e+02],\n",
      "            ...,\n",
      "            [-2.0788e+02,  2.9988e+01],\n",
      "            [-2.0788e+02,  3.7988e+01],\n",
      "            [-2.0788e+02,  4.5988e+01]],\n",
      "\n",
      "           [[-1.9988e+02, -2.6601e+02],\n",
      "            [-1.9988e+02, -2.5801e+02],\n",
      "            [-1.9988e+02, -2.5001e+02],\n",
      "            ...,\n",
      "            [-1.9988e+02,  2.9988e+01],\n",
      "            [-1.9988e+02,  3.7988e+01],\n",
      "            [-1.9988e+02,  4.5988e+01]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 1.2476e-01, -2.6601e+02],\n",
      "            [ 1.2476e-01, -2.5801e+02],\n",
      "            [ 1.2476e-01, -2.5001e+02],\n",
      "            ...,\n",
      "            [ 1.2476e-01,  2.9988e+01],\n",
      "            [ 1.2476e-01,  3.7988e+01],\n",
      "            [ 1.2476e-01,  4.5988e+01]],\n",
      "\n",
      "           [[ 8.1248e+00, -2.6601e+02],\n",
      "            [ 8.1248e+00, -2.5801e+02],\n",
      "            [ 8.1248e+00, -2.5001e+02],\n",
      "            ...,\n",
      "            [ 8.1248e+00,  2.9988e+01],\n",
      "            [ 8.1248e+00,  3.7988e+01],\n",
      "            [ 8.1248e+00,  4.5988e+01]],\n",
      "\n",
      "           [[ 1.6125e+01, -2.6601e+02],\n",
      "            [ 1.6125e+01, -2.5801e+02],\n",
      "            [ 1.6125e+01, -2.5001e+02],\n",
      "            ...,\n",
      "            [ 1.6125e+01,  2.9988e+01],\n",
      "            [ 1.6125e+01,  3.7988e+01],\n",
      "            [ 1.6125e+01,  4.5988e+01]]],\n",
      "\n",
      "\n",
      "          [[[-2.1572e+02, -2.7244e+02],\n",
      "            [-2.1572e+02, -2.6444e+02],\n",
      "            [-2.1572e+02, -2.5644e+02],\n",
      "            ...,\n",
      "            [-2.1572e+02,  2.3564e+01],\n",
      "            [-2.1572e+02,  3.1564e+01],\n",
      "            [-2.1572e+02,  3.9564e+01]],\n",
      "\n",
      "           [[-2.0772e+02, -2.7244e+02],\n",
      "            [-2.0772e+02, -2.6444e+02],\n",
      "            [-2.0772e+02, -2.5644e+02],\n",
      "            ...,\n",
      "            [-2.0772e+02,  2.3564e+01],\n",
      "            [-2.0772e+02,  3.1564e+01],\n",
      "            [-2.0772e+02,  3.9564e+01]],\n",
      "\n",
      "           [[-1.9972e+02, -2.7244e+02],\n",
      "            [-1.9972e+02, -2.6444e+02],\n",
      "            [-1.9972e+02, -2.5644e+02],\n",
      "            ...,\n",
      "            [-1.9972e+02,  2.3564e+01],\n",
      "            [-1.9972e+02,  3.1564e+01],\n",
      "            [-1.9972e+02,  3.9564e+01]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 2.7676e-01, -2.7244e+02],\n",
      "            [ 2.7676e-01, -2.6444e+02],\n",
      "            [ 2.7676e-01, -2.5644e+02],\n",
      "            ...,\n",
      "            [ 2.7676e-01,  2.3564e+01],\n",
      "            [ 2.7676e-01,  3.1564e+01],\n",
      "            [ 2.7676e-01,  3.9564e+01]],\n",
      "\n",
      "           [[ 8.2768e+00, -2.7244e+02],\n",
      "            [ 8.2768e+00, -2.6444e+02],\n",
      "            [ 8.2768e+00, -2.5644e+02],\n",
      "            ...,\n",
      "            [ 8.2768e+00,  2.3564e+01],\n",
      "            [ 8.2768e+00,  3.1564e+01],\n",
      "            [ 8.2768e+00,  3.9564e+01]],\n",
      "\n",
      "           [[ 1.6277e+01, -2.7244e+02],\n",
      "            [ 1.6277e+01, -2.6444e+02],\n",
      "            [ 1.6277e+01, -2.5644e+02],\n",
      "            ...,\n",
      "            [ 1.6277e+01,  2.3564e+01],\n",
      "            [ 1.6277e+01,  3.1564e+01],\n",
      "            [ 1.6277e+01,  3.9564e+01]]],\n",
      "\n",
      "\n",
      "          [[[-2.1557e+02, -2.7885e+02],\n",
      "            [-2.1557e+02, -2.7085e+02],\n",
      "            [-2.1557e+02, -2.6285e+02],\n",
      "            ...,\n",
      "            [-2.1557e+02,  1.7149e+01],\n",
      "            [-2.1557e+02,  2.5149e+01],\n",
      "            [-2.1557e+02,  3.3149e+01]],\n",
      "\n",
      "           [[-2.0757e+02, -2.7885e+02],\n",
      "            [-2.0757e+02, -2.7085e+02],\n",
      "            [-2.0757e+02, -2.6285e+02],\n",
      "            ...,\n",
      "            [-2.0757e+02,  1.7149e+01],\n",
      "            [-2.0757e+02,  2.5149e+01],\n",
      "            [-2.0757e+02,  3.3149e+01]],\n",
      "\n",
      "           [[-1.9957e+02, -2.7885e+02],\n",
      "            [-1.9957e+02, -2.7085e+02],\n",
      "            [-1.9957e+02, -2.6285e+02],\n",
      "            ...,\n",
      "            [-1.9957e+02,  1.7149e+01],\n",
      "            [-1.9957e+02,  2.5149e+01],\n",
      "            [-1.9957e+02,  3.3149e+01]],\n",
      "\n",
      "           ...,\n",
      "\n",
      "           [[ 4.2856e-01, -2.7885e+02],\n",
      "            [ 4.2856e-01, -2.7085e+02],\n",
      "            [ 4.2856e-01, -2.6285e+02],\n",
      "            ...,\n",
      "            [ 4.2856e-01,  1.7149e+01],\n",
      "            [ 4.2856e-01,  2.5149e+01],\n",
      "            [ 4.2856e-01,  3.3149e+01]],\n",
      "\n",
      "           [[ 8.4286e+00, -2.7885e+02],\n",
      "            [ 8.4286e+00, -2.7085e+02],\n",
      "            [ 8.4286e+00, -2.6285e+02],\n",
      "            ...,\n",
      "            [ 8.4286e+00,  1.7149e+01],\n",
      "            [ 8.4286e+00,  2.5149e+01],\n",
      "            [ 8.4286e+00,  3.3149e+01]],\n",
      "\n",
      "           [[ 1.6429e+01, -2.7885e+02],\n",
      "            [ 1.6429e+01, -2.7085e+02],\n",
      "            [ 1.6429e+01, -2.6285e+02],\n",
      "            ...,\n",
      "            [ 1.6429e+01,  1.7149e+01],\n",
      "            [ 1.6429e+01,  2.5149e+01],\n",
      "            [ 1.6429e+01,  3.3149e+01]]]]]])\n",
      "cell_distances:  tensor([[[[[ 35.9350,  28.0509,  20.2578,  ..., 260.5260, 268.5243,\n",
      "            276.5228],\n",
      "           [ 35.6259,  27.6538,  19.7042,  ..., 260.4835, 268.4831,\n",
      "            276.4828],\n",
      "           [ 37.0821,  29.5061,  22.2292,  ..., 260.6867, 268.6802,\n",
      "            276.6742],\n",
      "           ...,\n",
      "           [213.5932, 212.4090, 211.5209,  ..., 334.9694, 341.2272,\n",
      "            347.5565],\n",
      "           [221.4857, 220.3439, 219.4880,  ..., 340.0564, 346.2224,\n",
      "            352.4619],\n",
      "           [229.3857, 228.2834, 227.4574,  ..., 345.2539, 351.3286,\n",
      "            357.4791]],\n",
      "\n",
      "          [[ 42.3327,  34.4130,  26.5414,  ..., 254.0692, 262.0674,\n",
      "            270.0658],\n",
      "           [ 42.0690,  34.0880,  26.1186,  ..., 254.0254, 262.0249,\n",
      "            270.0246],\n",
      "           [ 43.3075,  35.6052,  28.0699,  ..., 254.2334, 262.2267,\n",
      "            270.2203],\n",
      "           ...,\n",
      "           [214.7533, 213.3335, 212.2060,  ..., 329.9668, 336.1640,\n",
      "            342.4361],\n",
      "           [222.6044, 221.2350, 220.1479,  ..., 335.1295, 341.2331,\n",
      "            347.4136],\n",
      "           [230.4658, 229.1433, 228.0940,  ..., 340.4021, 346.4127,\n",
      "            352.5024]],\n",
      "\n",
      "          [[ 48.7369,  40.7958,  32.8832,  ..., 247.6221, 255.6203,\n",
      "            263.6186],\n",
      "           [ 48.5065,  40.5203,  32.5408,  ..., 247.5769, 255.5764,\n",
      "            263.5760],\n",
      "           [ 49.5831,  41.8030,  34.1248,  ..., 247.7900, 255.7829,\n",
      "            263.7763],\n",
      "           ...,\n",
      "           [216.0982, 214.4468, 213.0832,  ..., 325.0229, 331.1569,\n",
      "            337.3691],\n",
      "           [223.9018, 222.3084, 220.9933,  ..., 330.2627, 336.3011,\n",
      "            342.4200],\n",
      "           [231.7189, 230.1796, 228.9097,  ..., 335.6115, 341.5554,\n",
      "            347.5818]],\n",
      "\n",
      "          ...,\n",
      "\n",
      "          [[268.2826, 260.2844, 252.2864,  ...,  28.3565,  36.2289,\n",
      "             44.1473],\n",
      "           [268.2319, 260.2322, 252.2325,  ...,  27.8731,  35.8519,\n",
      "             43.8384],\n",
      "           [268.4198, 260.4259, 252.4323,  ...,  29.6266,  37.2315,\n",
      "             44.9736],\n",
      "           ...,\n",
      "           [340.8369, 334.5776, 328.3940,  ..., 212.1280, 213.3231,\n",
      "            214.8097],\n",
      "           [345.8303, 339.6631, 333.5738,  ..., 220.0616, 221.2139,\n",
      "            222.6478],\n",
      "           [350.9350, 344.8592, 338.8632,  ..., 227.9999, 229.1122,\n",
      "            230.4969]],\n",
      "\n",
      "          [[274.3964, 266.3982, 258.4001,  ...,  22.4021,  30.2070,\n",
      "             38.0929],\n",
      "           [274.3466, 266.3469, 258.3472,  ...,  21.7840,  29.7515,\n",
      "             37.7327],\n",
      "           [274.5301, 266.5359, 258.5420,  ...,  23.9840,  31.3981,\n",
      "             39.0442],\n",
      "           ...,\n",
      "           [345.6646, 339.3503, 333.1084,  ..., 211.4059, 212.3749,\n",
      "            213.6392],\n",
      "           [350.5891, 344.3651, 338.2158,  ..., 219.3654, 220.2993,\n",
      "            221.5184],\n",
      "           [355.6253, 349.4910, 343.4335,  ..., 227.3276, 228.2290,\n",
      "            229.4059]],\n",
      "\n",
      "          [[280.5013, 272.5031, 264.5049,  ...,  16.5735,  24.2403,\n",
      "             32.0702],\n",
      "           [280.4524, 272.4527, 264.4530,  ...,  15.7238,  23.6674,\n",
      "             31.6395],\n",
      "           [280.6317, 272.6372, 264.6430,  ...,  18.6492,  25.7042,\n",
      "             33.1906],\n",
      "           ...,\n",
      "           [350.5254, 344.1583, 337.8607,  ..., 210.8595, 211.6002,\n",
      "            212.6395],\n",
      "           [355.3823, 349.1039, 342.8971,  ..., 218.8385, 219.5522,\n",
      "            220.5541],\n",
      "           [360.3514, 354.1611, 348.0445,  ..., 226.8190, 227.5077,\n",
      "            228.4746]]],\n",
      "\n",
      "\n",
      "         [[[ 37.2156,  29.8003,  22.7841,  ..., 261.2397, 269.2309,\n",
      "            277.2225],\n",
      "           [ 35.3445,  27.4280,  19.5794,  ..., 260.9798, 268.9786,\n",
      "            276.9775],\n",
      "           [ 35.2345,  27.2861,  19.3802,  ..., 260.9649, 268.9642,\n",
      "            276.9635],\n",
      "           ...,\n",
      "           [206.5125, 205.3057, 204.4053,  ..., 330.9208, 337.2650,\n",
      "            343.6782],\n",
      "           [214.4006, 213.2386, 212.3717,  ..., 335.9000, 342.1519,\n",
      "            348.4752],\n",
      "           [222.2968, 221.1762, 220.3406,  ..., 340.9942, 347.1543,\n",
      "            353.3882]],\n",
      "\n",
      "          [[ 43.3657,  35.7789,  28.4196,  ..., 254.7778, 262.7684,\n",
      "            270.7597],\n",
      "           [ 41.7704,  33.8276,  25.9201,  ..., 254.5111, 262.5099,\n",
      "            270.5087],\n",
      "           [ 41.6767,  33.7119,  25.7689,  ..., 254.4957, 262.4950,\n",
      "            270.4943],\n",
      "           ...,\n",
      "           [207.7053, 206.2548, 205.1062,  ..., 325.8414, 332.1267,\n",
      "            338.4844],\n",
      "           [215.5497, 214.1523, 213.0464,  ..., 330.8970, 337.0880,\n",
      "            343.3539],\n",
      "           [223.4051, 222.0572, 220.9908,  ..., 336.0669, 342.1645,\n",
      "            348.3390]],\n",
      "\n",
      "          [[ 49.5879,  41.8944,  34.3413,  ..., 248.3258, 256.3160,\n",
      "            264.3068],\n",
      "           [ 48.1984,  40.2401,  32.3024,  ..., 248.0521, 256.0508,\n",
      "            264.0496],\n",
      "           [ 48.1166,  40.1421,  32.1803,  ..., 248.0362, 256.0354,\n",
      "            264.0347],\n",
      "           ...,\n",
      "           [209.0894, 207.3995, 206.0066,  ..., 320.8195, 327.0433,\n",
      "            333.3429],\n",
      "           [216.8836, 215.2549, 213.9132,  ..., 325.9529, 332.0804,\n",
      "            338.2863],\n",
      "           [224.6923, 223.1206, 221.8265,  ..., 331.1999, 337.2322,\n",
      "            343.3449]],\n",
      "\n",
      "          ...,\n",
      "\n",
      "          [[268.4457, 260.4548, 252.4645,  ...,  30.5723,  38.0036,\n",
      "             45.6277],\n",
      "           [268.1890, 260.1902, 252.1915,  ...,  28.2296,  36.1458,\n",
      "             44.0923],\n",
      "           [268.1708, 260.1715, 252.1722,  ...,  28.0562,  36.0105,\n",
      "             43.9815],\n",
      "           ...,\n",
      "           [336.5585, 330.2200, 323.9550,  ..., 205.2881, 206.5255,\n",
      "            208.0635],\n",
      "           [341.4526, 335.2066, 329.0366,  ..., 213.2169, 214.4086,\n",
      "            215.8904],\n",
      "           [346.4623, 340.3083, 334.2325,  ..., 221.1508, 222.3000,\n",
      "            223.7295]],\n",
      "\n",
      "          [[274.5644, 266.5731, 258.5823,  ...,  25.1215,  32.2908,\n",
      "             39.7782],\n",
      "           [274.3133, 266.3145, 258.3157,  ...,  22.2098,  30.0813,\n",
      "             38.0065],\n",
      "           [274.2954, 266.2961, 258.2967,  ...,  21.9879,  29.9178,\n",
      "             37.8772],\n",
      "           ...,\n",
      "           [341.4568, 335.0647, 328.7430,  ..., 204.5439, 205.5476,\n",
      "            206.8560],\n",
      "           [346.2816, 339.9802, 333.7516,  ..., 212.5003, 213.4666,\n",
      "            214.7268],\n",
      "           [351.2223, 345.0112, 338.8751,  ..., 220.4599, 221.3915,\n",
      "            222.6068]],\n",
      "\n",
      "          [[280.6744, 272.6828, 264.6916,  ...,  20.0705,  26.7689,\n",
      "             34.0341],\n",
      "           [280.4287, 272.4299, 264.4311,  ...,  16.2776,  24.0564,\n",
      "             31.9446],\n",
      "           [280.4112, 272.4117, 264.4124,  ...,  15.9718,  23.8505,\n",
      "             31.7898],\n",
      "           ...,\n",
      "           [346.3868, 339.9435, 333.5676,  ..., 203.9817, 204.7493,\n",
      "            205.8252],\n",
      "           [351.1438, 344.7894, 338.5048,  ..., 211.9591, 212.6979,\n",
      "            213.7338],\n",
      "           [356.0170, 349.7512, 343.5573,  ..., 219.9382, 220.6503,\n",
      "            221.6490]]],\n",
      "\n",
      "\n",
      "         [[[ 39.7598,  33.0373,  27.0200,  ..., 262.1483, 270.1266,\n",
      "            278.1061],\n",
      "           [ 36.4836,  29.0116,  21.9155,  ..., 261.6715, 269.6638,\n",
      "            277.6566],\n",
      "           [ 34.7744,  26.8306,  18.9340,  ..., 261.4386, 269.4379,\n",
      "            277.4372],\n",
      "           ...,\n",
      "           [199.4102, 198.1794, 197.2655,  ..., 326.9638, 333.3946,\n",
      "            339.8920],\n",
      "           [207.2936, 206.1099, 205.2313,  ..., 331.8306, 338.1689,\n",
      "            344.5763],\n",
      "           [215.1857, 214.0455, 213.1997,  ..., 336.8171, 343.0632,\n",
      "            349.3809]],\n",
      "\n",
      "          [[ 45.5093,  38.4449,  31.8266,  ..., 255.6857, 263.6628,\n",
      "            271.6413],\n",
      "           [ 42.6770,  35.0464,  27.6256,  ..., 255.1968, 263.1888,\n",
      "            271.1812],\n",
      "           [ 41.2258,  33.2639,  25.3261,  ..., 254.9581, 262.9573,\n",
      "            270.9566],\n",
      "           ...,\n",
      "           [200.6378, 199.1543, 197.9832,  ..., 321.8068, 328.1806,\n",
      "            334.6243],\n",
      "           [208.4748, 207.0475, 205.9213,  ..., 326.7504, 333.0296,\n",
      "            339.3813],\n",
      "           [216.3238, 214.9486, 213.8640,  ..., 331.8133, 337.9985,\n",
      "            344.2585]],\n",
      "\n",
      "          [[ 51.4240,  44.1339,  37.1373,  ..., 249.2337, 257.2097,\n",
      "            265.1871],\n",
      "           [ 48.9356,  41.2077,  33.6073,  ..., 248.7322, 256.7237,\n",
      "            264.7158],\n",
      "           [ 47.6756,  39.7031,  31.7446,  ..., 248.4874, 256.4865,\n",
      "            264.4857],\n",
      "           ...,\n",
      "           [202.0635, 200.3323, 198.9081,  ..., 316.7060, 323.0202,\n",
      "            329.4077],\n",
      "           [209.8474, 208.1810, 206.8107,  ..., 321.7280, 327.9456,\n",
      "            334.2390],\n",
      "           [217.6470, 216.0407, 214.7206,  ..., 326.8688, 332.9904,\n",
      "            339.1902]],\n",
      "\n",
      "          ...,\n",
      "\n",
      "          [[268.7880, 260.8098, 252.8330,  ...,  34.0837,  40.8959,\n",
      "             48.0755],\n",
      "           [268.3249, 260.3326, 252.3407,  ...,  30.2157,  37.7328,\n",
      "             45.4152],\n",
      "           [268.0999, 260.1006, 252.1014,  ...,  28.1475,  36.0979,\n",
      "             44.0663],\n",
      "           ...,\n",
      "           [332.3551, 325.9366, 319.5895,  ..., 198.4304, 199.7133,\n",
      "            201.3062],\n",
      "           [337.1457, 330.8202, 324.5685,  ..., 206.3539, 207.5878,\n",
      "            209.1207],\n",
      "           [342.0563, 335.8233, 329.6666,  ..., 214.2830, 215.4716,\n",
      "            216.9488]],\n",
      "\n",
      "          [[274.9073, 266.9282, 258.9503,  ...,  29.2682,  35.6264,\n",
      "             42.5423],\n",
      "           [274.4547, 266.4619, 258.4697,  ...,  24.6567,  31.9462,\n",
      "             39.5117],\n",
      "           [274.2347, 266.2354, 258.2361,  ...,  22.0743,  29.9981,\n",
      "             37.9538],\n",
      "           ...,\n",
      "           [337.3244, 330.8540, 324.4518,  ..., 197.6622, 198.7032,\n",
      "            200.0589],\n",
      "           [342.0454, 335.6660, 329.3574,  ..., 205.6153, 206.6162,\n",
      "            207.9203],\n",
      "           [346.8867, 340.5980, 334.3824,  ..., 213.5719, 214.5358,\n",
      "            215.7920]],\n",
      "\n",
      "          [[281.0184, 273.0384, 265.0595,  ...,  25.0425,  30.6874,\n",
      "             37.2062],\n",
      "           [280.5757, 272.5826, 264.5900,  ...,  19.4545,  26.3261,\n",
      "             33.6994],\n",
      "           [280.3606, 272.3612, 264.3619,  ...,  16.0570,  23.9252,\n",
      "             31.8591],\n",
      "           ...,\n",
      "           [342.3242, 335.8041, 329.3494,  ..., 197.0827, 197.8792,\n",
      "            198.9944],\n",
      "           [346.9772, 340.5463, 334.1831,  ..., 205.0584, 205.8240,\n",
      "            206.8964],\n",
      "           [351.7507, 345.4086, 339.1367,  ..., 213.0359, 213.7730,\n",
      "            214.8057]]],\n",
      "\n",
      "\n",
      "         ...,\n",
      "\n",
      "\n",
      "         [[[207.2303, 206.5254, 206.1289,  ..., 342.6390, 349.0642,\n",
      "            355.5534],\n",
      "           [199.2783, 198.5452, 198.1327,  ..., 337.8889, 344.4028,\n",
      "            350.9781],\n",
      "           [191.3303, 190.5666, 190.1368,  ..., 333.2632, 339.8658,\n",
      "            346.5272],\n",
      "           ...,\n",
      "           [ 24.3595,  17.3706,  11.7513,  ..., 273.9534, 281.9483,\n",
      "            289.9434],\n",
      "           [ 28.5802,  22.9169,  19.0141,  ..., 274.3610, 282.3443,\n",
      "            290.3285],\n",
      "           [ 34.1800,  29.6079,  26.7017,  ..., 275.0007, 282.9659,\n",
      "            290.9331]],\n",
      "\n",
      "          [[207.9199, 206.9555, 206.2970,  ..., 337.1565, 343.5264,\n",
      "            349.9632],\n",
      "           [200.0013, 198.9985, 198.3136,  ..., 332.3316, 338.7923,\n",
      "            345.3174],\n",
      "           [192.0894, 191.0451, 190.3316,  ..., 327.6311, 334.1826,\n",
      "            340.7960],\n",
      "           ...,\n",
      "           [ 30.7196,  23.3148,  16.4762,  ..., 267.1844, 275.1788,\n",
      "            283.1736],\n",
      "           [ 34.1981,  27.7380,  22.2998,  ..., 267.6066, 275.5888,\n",
      "            283.5720],\n",
      "           [ 39.0298,  33.5143,  29.1735,  ..., 268.2669, 276.2300,\n",
      "            284.1952]],\n",
      "\n",
      "          [[208.8260, 207.6051, 206.6869,  ..., 331.7304, 338.0424,\n",
      "            344.4245],\n",
      "           [200.9489, 199.6799, 198.7251,  ..., 326.8291, 333.2339,\n",
      "            339.7064],\n",
      "           [193.0820, 191.7609, 190.7664,  ..., 322.0519, 328.5499,\n",
      "            335.1129],\n",
      "           ...,\n",
      "           [ 37.2182,  29.6106,  22.2794,  ..., 260.4265, 268.4205,\n",
      "            276.4148],\n",
      "           [ 40.1669,  33.2410,  26.9176,  ..., 260.8643, 268.8452,\n",
      "            276.8273],\n",
      "           [ 44.3797,  38.2250,  32.8746,  ..., 261.5461, 269.5068,\n",
      "            277.4698]],\n",
      "\n",
      "          ...,\n",
      "\n",
      "          [[333.3600, 327.0079, 320.7295,  ..., 202.9073, 204.2367,\n",
      "            205.8686],\n",
      "           [328.6057, 322.1598, 315.7850,  ..., 194.9977, 196.3807,\n",
      "            198.0773],\n",
      "           [323.9790, 317.4392, 310.9677,  ..., 187.0959, 188.5368,\n",
      "            190.3034],\n",
      "           ...,\n",
      "           [266.6107, 258.6243, 250.6388,  ...,  33.5222,  40.8044,\n",
      "             48.3141],\n",
      "           [267.1891, 259.2206, 251.2540,  ...,  37.8483,  44.4269,\n",
      "             51.4102],\n",
      "           [268.0052, 260.0616, 252.1216,  ...,  43.2348,  49.0969,\n",
      "             55.4956]],\n",
      "\n",
      "          [[338.4108, 332.0010, 325.6617,  ..., 201.9264, 203.0101,\n",
      "            204.4014],\n",
      "           [333.7317, 327.2303, 320.7967,  ..., 193.9826, 195.1104,\n",
      "            196.5576],\n",
      "           [329.1806, 322.5875, 316.0593,  ..., 186.0437, 187.2193,\n",
      "            188.7271],\n",
      "           ...,\n",
      "           [273.0104, 265.0236, 257.0376,  ...,  28.0553,  35.0131,\n",
      "             42.3408],\n",
      "           [273.5794, 265.6097, 257.6418,  ...,  33.1375,  39.2035,\n",
      "             45.8665],\n",
      "           [274.3805, 266.4348, 258.4924,  ...,  39.2057,  44.4512,\n",
      "             50.4255]],\n",
      "\n",
      "          [[343.4989, 337.0342, 330.6366,  ..., 201.1457, 201.9806,\n",
      "            203.1273],\n",
      "           [338.8934, 332.3391, 325.8494,  ..., 193.1757, 194.0448,\n",
      "            195.2381],\n",
      "           [334.4159, 327.7720, 321.1900,  ..., 185.2082, 186.1145,\n",
      "            187.3584],\n",
      "           ...,\n",
      "           [279.4006, 271.4134, 263.4270,  ...,  23.0823,  29.4845,\n",
      "             36.5223],\n",
      "           [279.9606, 271.9898, 264.0208,  ...,  29.0865,  34.3885,\n",
      "             40.5846],\n",
      "           [280.7475, 272.7997, 264.8551,  ...,  35.8783,  40.2963,\n",
      "             45.6983]]],\n",
      "\n",
      "\n",
      "         [[[214.9370, 214.2767, 213.9139,  ..., 347.7948, 354.1382,\n",
      "            360.5475],\n",
      "           [206.9795, 206.2938, 205.9169,  ..., 342.9341, 349.3658,\n",
      "            355.8610],\n",
      "           [199.0254, 198.3122, 197.9201,  ..., 338.1929, 344.7130,\n",
      "            351.2943],\n",
      "           ...,\n",
      "           [ 21.8180,  13.8801,   6.1063,  ..., 274.2979, 282.2977,\n",
      "            290.2975],\n",
      "           [ 23.9713,  17.0662,  11.6569,  ..., 274.4776, 282.4723,\n",
      "            290.4672],\n",
      "           [ 28.3058,  22.7563,  19.0389,  ..., 274.8901, 282.8731,\n",
      "            290.8570]],\n",
      "\n",
      "          [[215.5756, 214.6644, 214.0485,  ..., 342.3675, 348.6537,\n",
      "            355.0090],\n",
      "           [207.6485, 206.7024, 206.0627,  ..., 337.4323, 343.8088,\n",
      "            350.2520],\n",
      "           [199.7273, 198.7434, 198.0780,  ..., 332.6163, 339.0834,\n",
      "            345.6147],\n",
      "           ...,\n",
      "           [ 28.5963,  20.6328,  12.7152,  ..., 267.5077, 275.5074,\n",
      "            283.5071],\n",
      "           [ 30.3121,  22.9518,  16.2095,  ..., 267.6966, 275.6908,\n",
      "            283.6853],\n",
      "           [ 33.8806,  27.4928,  22.1770,  ..., 268.1241, 276.1059,\n",
      "            284.0888]],\n",
      "\n",
      "          [[216.4242, 215.2647, 214.3977,  ..., 336.9980, 343.2246,\n",
      "            349.5234],\n",
      "           [208.5353, 207.3317, 206.4314,  ..., 331.9868, 338.3056,\n",
      "            344.6943],\n",
      "           [200.6552, 199.4041, 198.4678,  ..., 327.0944, 333.5060,\n",
      "            339.9848],\n",
      "           ...,\n",
      "           [ 35.3698,  27.3951,  19.4411,  ..., 260.7283, 268.7280,\n",
      "            276.7277],\n",
      "           [ 36.8044,  29.2238,  21.9430,  ..., 260.9268, 268.9206,\n",
      "            276.9147],\n",
      "           [ 39.8259,  32.9480,  26.7027,  ..., 261.3701, 269.3507,\n",
      "            277.3324]],\n",
      "\n",
      "          ...,\n",
      "\n",
      "          [[337.9108, 331.6478, 325.4609,  ..., 210.4123, 211.6976,\n",
      "            213.2754],\n",
      "           [333.0395, 326.6831, 320.4003,  ..., 202.4967, 203.8319,\n",
      "            205.4701],\n",
      "           [328.2909, 321.8407, 315.4615,  ..., 194.5880, 195.9771,\n",
      "            197.6805],\n",
      "           ...,\n",
      "           [266.2040, 258.2075, 250.2111,  ...,  30.8894,  38.6870,\n",
      "             46.5534],\n",
      "           [266.5561, 258.5704, 250.5857,  ...,  33.7897,  41.0399,\n",
      "             48.5263],\n",
      "           [267.1474, 259.1800, 251.2146,  ...,  38.1750,  44.7198,\n",
      "             51.6758]],\n",
      "\n",
      "          [[342.8952, 336.5725, 330.3225,  ..., 209.4518, 210.4994,\n",
      "            211.8441],\n",
      "           [338.0992, 331.6850, 325.3412,  ..., 201.5043, 202.5930,\n",
      "            203.9898],\n",
      "           [333.4261, 326.9203, 320.4821,  ..., 193.5611, 194.6942,\n",
      "            196.1473],\n",
      "           ...,\n",
      "           [272.6188, 264.6222, 256.6259,  ...,  24.7779,  32.4633,\n",
      "             40.2713],\n",
      "           [272.9669, 264.9808, 256.9956,  ...,  28.3526,  35.2673,\n",
      "             42.5641],\n",
      "           [273.5486, 265.5800, 257.6134,  ...,  33.4931,  39.5184,\n",
      "             46.1478]],\n",
      "\n",
      "          [[347.9188, 341.5391, 335.2289,  ..., 208.6853, 209.4922,\n",
      "            210.6002],\n",
      "           [343.1963, 336.7272, 330.3250,  ..., 200.7132, 201.5521,\n",
      "            202.7035],\n",
      "           [338.5970, 332.0383, 325.5440,  ..., 192.7435, 193.6169,\n",
      "            194.8152],\n",
      "           ...,\n",
      "           [279.0238, 271.0272, 263.0308,  ...,  18.8777,  26.3406,\n",
      "             34.0483],\n",
      "           [279.3681, 271.3817, 263.3960,  ...,  23.4226,  29.7671,\n",
      "             36.7633],\n",
      "           [279.9407, 271.9711, 264.0033,  ...,  29.4767,  34.7323,\n",
      "             40.8876]]],\n",
      "\n",
      "\n",
      "         [[[222.6791, 222.0606, 221.7292,  ..., 353.0674, 359.3293,\n",
      "            365.6590],\n",
      "           [214.7168, 214.0753, 213.7315,  ..., 348.1004, 354.4501,\n",
      "            360.8654],\n",
      "           [206.7573, 206.0911, 205.7340,  ..., 343.2480, 349.6858,\n",
      "            356.1869],\n",
      "           ...,\n",
      "           [ 21.9365,  14.3578,   7.6865,  ..., 274.8669, 282.8653,\n",
      "            290.8637],\n",
      "           [ 21.3194,  13.3959,   5.6910,  ..., 274.8184, 282.8181,\n",
      "            290.8178],\n",
      "           [ 23.5758,  16.7558,  11.5625,  ..., 275.0027, 282.9972,\n",
      "            290.9920]],\n",
      "\n",
      "          [[223.2696, 222.4081, 221.8320,  ..., 347.6950, 353.8981,\n",
      "            360.1721],\n",
      "           [215.3351, 214.4417, 213.8441,  ..., 342.6539, 348.9467,\n",
      "            355.3081],\n",
      "           [207.4056, 206.4779, 205.8572,  ..., 337.7271, 344.1100,\n",
      "            350.5592],\n",
      "           ...,\n",
      "           [ 28.5323,  20.7403,  13.1996,  ..., 268.0609, 276.0592,\n",
      "            284.0577],\n",
      "           [ 28.1065,  20.1505,  12.2520,  ..., 268.0159, 276.0155,\n",
      "            284.0152],\n",
      "           [ 29.8974,  22.5815,  15.9371,  ..., 268.2096, 276.2036,\n",
      "            284.1980]],\n",
      "\n",
      "          [[224.0639, 222.9619, 222.1427,  ..., 342.3819, 348.5237,\n",
      "            354.7395],\n",
      "           [216.1645, 215.0220, 214.1725,  ..., 337.2652, 343.4985,\n",
      "            349.8036],\n",
      "           [208.2728, 207.0868, 206.2045,  ..., 332.2624, 338.5877,\n",
      "            344.9826],\n",
      "           ...,\n",
      "           [ 35.1978,  27.3176,  19.5352,  ..., 261.2654, 269.2638,\n",
      "            277.2623],\n",
      "           [ 34.8903,  26.9204,  18.9757,  ..., 261.2242, 269.2238,\n",
      "            277.2234],\n",
      "           [ 36.3839,  28.8298,  21.5993,  ..., 261.4279, 269.4214,\n",
      "            277.4153]],\n",
      "\n",
      "          ...,\n",
      "\n",
      "          [[342.5850, 336.4109, 330.3152,  ..., 217.9482, 219.1922,\n",
      "            220.7193],\n",
      "           [337.6011, 331.3341, 325.1432,  ..., 210.0271, 211.3178,\n",
      "            212.9014],\n",
      "           [332.7348, 326.3745, 320.0876,  ..., 202.1123, 203.4532,\n",
      "            205.0976],\n",
      "           ...,\n",
      "           [266.0120, 258.0120, 250.0120,  ...,  29.9883,  37.9882,\n",
      "             45.9882],\n",
      "           [266.1360, 258.1399, 250.1439,  ...,  31.0692,  38.8472,\n",
      "             46.7002],\n",
      "           [266.5002, 258.5154, 250.5314,  ...,  34.0484,  41.2686,\n",
      "             48.7330]],\n",
      "\n",
      "          [[347.5027, 341.2670, 335.1062,  ..., 217.0063, 218.0201,\n",
      "            219.3212],\n",
      "           [342.5939, 336.2671, 330.0130,  ..., 209.0555, 210.1076,\n",
      "            211.4574],\n",
      "           [337.8032, 331.3850, 325.0370,  ..., 201.1085, 202.2020,\n",
      "            203.6041],\n",
      "           ...,\n",
      "           [272.4366, 264.4366, 256.4366,  ...,  23.5652,  31.5648,\n",
      "             39.5645],\n",
      "           [272.5621, 264.5659, 256.5700,  ...,  24.9749,  32.6307,\n",
      "             40.4201],\n",
      "           [272.9222, 264.9369, 256.9525,  ...,  28.6387,  35.5133,\n",
      "             42.7809]],\n",
      "\n",
      "          [[352.4613, 346.1667, 339.9438,  ..., 216.2525, 217.0334,\n",
      "            218.1052],\n",
      "           [347.6260, 341.2422, 334.9278,  ..., 208.2786, 209.0894,\n",
      "            210.2017],\n",
      "           [342.9092, 336.4359, 330.0295,  ..., 200.3069, 201.1498,\n",
      "            202.3057],\n",
      "           ...,\n",
      "           [278.8514, 270.8514, 262.8515,  ...,  17.1542,  25.1525,\n",
      "             33.1517],\n",
      "           [278.9785, 270.9822, 262.9862,  ...,  19.1082,  26.5237,\n",
      "             34.2037],\n",
      "           [279.3346, 271.3489, 263.3640,  ...,  23.7483,  30.0394,\n",
      "             36.9966]]]]])\n"
     ]
    }
   ],
   "source": [
    "from utils.utils import warp_points\n",
    "def desc_mask(homographies, cell_size=8, device='cpu'):\n",
    "    from utils.utils import warp_points\n",
    "\n",
    "    def normPts(pts, shape):\n",
    "        \"\"\"\n",
    "        normalize pts to [-1, 1]\n",
    "        :param pts:\n",
    "            tensor (y, x)\n",
    "        :param shape:\n",
    "            numpy (y, x)\n",
    "        :return:\n",
    "        \"\"\"\n",
    "        pts = pts/shape*2 - 1\n",
    "        return pts\n",
    "\n",
    "    def denormPts(pts, shape):\n",
    "        \"\"\"\n",
    "        denormalize pts back to H, W\n",
    "        :param pts:\n",
    "            tensor (y, x)\n",
    "        :param shape:\n",
    "            numpy (y, x)\n",
    "        :return:\n",
    "        \"\"\"\n",
    "        pts = (pts+1)*shape/2\n",
    "        return pts\n",
    "    \n",
    "    debug = True\n",
    "    Hc, Wc = 30, 40\n",
    "    print(\"homo \", homographies.shape)\n",
    "    shape = torch.tensor([240, 320]).type(torch.FloatTensor).to(device)\n",
    "    if debug: print(\"shape: \", shape)\n",
    "    # compute the center pixel of every cell in the image\n",
    "    coor_cells = torch.stack(torch.meshgrid(torch.arange(Hc), torch.arange(Wc)), dim=2)\n",
    "    if debug: print(\"coor_cells: \", coor_cells)\n",
    "    coor_cells = coor_cells.type(torch.FloatTensor).to(device)\n",
    "    if debug: print(\"coor_cells: \", coor_cells)\n",
    "    coor_cells = coor_cells * cell_size + cell_size // 2\n",
    "    if debug: print(\"coor_cells: \", coor_cells)\n",
    "    \n",
    "\n",
    "    ## coord_cells is now a grid containing the coordinates of the Hc x Wc\n",
    "    ## center pixels of the 8x8 cells of the image\n",
    "\n",
    "    # coor_cells = coor_cells.view([-1, Hc, Wc, 1, 1, 2])\n",
    "    coor_cells = coor_cells.view([-1, 1, 1, Hc, Wc, 2])  # be careful of the order\n",
    "    if debug: print(\"coor_cells: \", coor_cells)\n",
    "    # warped_coor_cells = warp_points(coor_cells.view([-1, 2]), w, device)\n",
    "    warped_coor_cells = normPts(coor_cells.view([-1, 2]), shape)\n",
    "    if debug: print(\"warped_coor_cells: \", warped_coor_cells)\n",
    "    warped_coor_cells = torch.stack((warped_coor_cells[:,1], warped_coor_cells[:,0]), dim=1) # (y, x) to (x, y)\n",
    "    if debug: print(\"warped_coor_cells: \", warped_coor_cells)\n",
    "    warped_coor_cells = warp_points(warped_coor_cells, homographies, device)\n",
    "    if debug: print(\"warped_coor_cells: \", warped_coor_cells)\n",
    "    print(\"shape: \", warped_coor_cells.shape)\n",
    "    warped_coor_cells = torch.stack((warped_coor_cells[:, :, 1], warped_coor_cells[:, :, 0]), dim=2)  # (batch, x, y) to (batch, y, x)\n",
    "    if debug: print(\"warped_coor_cells: \", warped_coor_cells)\n",
    "\n",
    "    shape_cell = torch.tensor([240/cell_size, 320/cell_size]).type(torch.FloatTensor).to(device)\n",
    "    # warped_coor_mask = denormPts(warped_coor_cells, shape_cell)\n",
    "\n",
    "    warped_coor_cells = denormPts(warped_coor_cells, shape)\n",
    "    print(\"warped: \", warped_coor_cells[0,:10,:])\n",
    "    # warped_coor_cells = warped_coor_cells.view([-1, 1, 1, Hc, Wc, 2])\n",
    "    warped_coor_cells = warped_coor_cells.view([-1, Hc, Wc, 1, 1, 2])\n",
    "#     print(\"warped_coor_cells: \", warped_coor_cells.shape)\n",
    "    # compute the pairwise distance\n",
    "    cell_distances = coor_cells - warped_coor_cells\n",
    "    if debug: print(\"cell_distances: \", cell_distances)\n",
    "    cell_distances = torch.norm(cell_distances, dim=-1)\n",
    "    if debug: print(\"cell_distances: \", cell_distances)\n",
    "    mask = cell_distances <= cell_size - 0.5 # trick\n",
    "    mask = mask.type(torch.FloatTensor).to(device)\n",
    "    return mask\n",
    "\n",
    "mask = desc_mask(torch.tensor(H).unsqueeze(0))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "mask shape torch.Size([1, 30, 40, 30, 40])\n",
      "(30, 40)\n",
      "the correspondence of ( 0 0 ) in image 1. [ 0 0 :,:]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhk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MeBP54WP8p4HvAi8A/AVum+N9sqZn+ZdhHB4G/ZzijPWsXvyEjSQ1PyEhSwzhKUsM4SlLDOEpSwzhKUsM4SlLDOEpSwzhKUuP/AJDTeUvjy4TeAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(30, 40)\n",
      "the correspondence of ( 29 39 ) in image 1. [ 29 39 :,:]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADFVJREFUeJzt3W+MZYVZx/HvT3ZZLGDKCm5WINISoiFGFzJiTUlTRSryBkgaAy+afUGyjSkJJDURa6L4wgSNQHxhMIsgG0VqLRB4QWy3SEKaGMqCCyxsFYqQsi67EmzAN5Q/jy/mbDKsz/xh7p17LuT7SW7uueeeO+fJYea799wzE1JVSJI+6CfGHkCS5pFxlKSGcZSkhnGUpIZxlKSGcZSkhnGUpIZxlKSGcZSkxqZJXpzkMuAvgROAv6mqm1fa/sRsqZM4eZJdStJE3uJ/Xq+qM1bbbt1xTHIC8FfApcCrwBNJHqqq55d7zUmczK/mkvXuUpIm9p365itr2W6S0+qLgBer6qWq+jHwdeCKCb6eJM2NSeJ4JvDDJY9fHdZJ0kfeRJ85rkWSXcAugJP4xEbvTpKmYpJ3joeAs5c8PmtY9wFVtbuqFqpqYTNbJtidJM3OJHF8AjgvyaeSnAhcDTw0nbEkaVzrPq2uqneTXAd8i8Vf5bmrqp6b2mSSNKKJPnOsqoeBh6c0iyTNDf9CRpIaxlGSGsZRkhrGUZIaxlGS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RHHQ8DZSx6fNawbTVUdGu6PAg+w+I01D44k2Q4w3B8dc5iqOjJ8s78P3MGMj1OSzSyG6J6qun9YPdox6uYZ+xgNM/wIeBT4NeCTSTYNT432s7ZkpsuGjySqqt4G/pb5+Xn7gDHi+ARw3nAV7UTgauChEeYAIMnJSU49tgx8ATiw8qtm5iFg57C8E3hwxFmOxeeYq5jhcUoS4E7gYFXduuSpUY7RcvOMdYySnJHkk8PyTwKXsvg56KPAF4fNZvo9tMxM31/yj1lY/Ax0Xn7ePmiMq0DA5Sxe3fsB8IdjXpFi8ar508PtubHmAe5l8TTsHRY/G7oW+GngEeAF4DvA1pHn+TvgWeAZFqO0fYbzXMziKfMzwP7hdvlYx2iFeUY5RsAvAf827PcA8EfD+k8D3wNeBP4J2DLD/2bLzfQvwzE6APw9wxXtebv5FzKS1PCCjCQ1jKMkNYyjJDWMoyQ1jKMkNYyjJDWMoyQ1jKMkNf4Pa6RvQGVLaxwAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(30, 40)\n",
      "the correspondence of ( 29 0 ) in image 1. [ 29 0 :,:]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADF1JREFUeJzt3W+sZIVZx/HvT3ZZLGDKCm5WINISoiFGF3LFmpKmilTkDZA0Bl40+4JkG1MSSGoi1kTxhQkagfjCYBZBNorUWiDwgthukYQ0MZQFF1jYKhQhZV12JdiAbyh/Hl/cs8llfe4f7sydM5DvJ5ncM2fO7HlyuPe7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PA58BvgFcPaz/a+B352Cmu4EvjvF99GFuY7xyvAh4sapeqqofA18HrhhhjrlSVY8Bbxy3+gpgz7C8B7hy5HlGU1WHq+qpYfkt4CBwJiMdoxXmGUUt+t/h7ubhVsBvAN8c1s/6e2i5mT4SxojjmcAPl9x/lRG/qQYFfDvJk0l2jTzLUtuq6vCw/BqwbcxhBtcleWY47Z7Zaf5SSc4BLmDxlcjox+i4eWCkY5TkhCT7gaPAXhbP0H5UVe8Om8z8Z+34marq2DH60+EY3ZZkyyxnWisvyCy6uKouBH4b+EqSz4090PFq8dxk7L91bwfOBXYAh4FbZj1AklOA+4AbqurNpY+NcYyaeUY7RlX1XlXtAM5i8QztF2a17+UcP1OSXwT+gMXZfgXYCvz+iCMua4w4HgLOXnL/rGHdaKrq0PD1KPAAi99Y8+BIku0Aw9ejYw5TVUeGb/b3gTuY8XFKspnFEN1TVfcPq0c7Rt08Yx+jYYYfAY8CvwZ8Msmx/x3KaD9rS2a6bHhLoqrqbeBvmZ+ftw8YI45PAOcNV9FOBK4GHhphDgCSnJzk1GPLwBeAAys/a2YeAnYOyzuBB0ec5Vh8jrmKGR6nJAHuBA5W1a1LHhrlGC03z1jHKMkZST45LP8kcCmL74M+Cnxx2Gym30PLzPT9JX+ZhcX3QOfl5+2DxrgKBFzO4tW9HwB/OOYVKRavmj893J4bax7gXhZPw95h8b2ha4GfBh4BXgC+A2wdeZ6/A54FnmExSttnOM/FLJ4yPwPsH26Xj3WMVphnlGME/BLwb8N+DwB/NKz/NPA94EXgn4AtM/xvttxM/zIcowPA3zNc0Z63m78hI0kNL8hIUsM4SlLDOEpSwzhKUsM4SlLDOEpSwzhKUsM4SlLj/wDyHHGxJ9mjGAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(30, 40)\n",
      "the correspondence of ( 0 39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ybao/Q0vM9P0Ff5iF+fdAZ+X37b3GuAoEXM781b0fAH805hUp5q+aPzXcnhlrHuBe5k/D3mL+vaFrgZ8BHgaeB74DbB15nr8DngYOMB+l7VOc52LmT5kPAPuH2+VjHaNl5hnlGAGfBP51eN6DwB8P6z8BfA94AfgnYMsU/5stNdM/D8foIPD3DFe0Z+3mJ2QkqeEFGUlqGEdJahhHSWoYR0lqGEdJahhHSWoYR0lqGEdJavwvuXp5S9Le6MsAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(30, 40)\n",
      "the correspondence of ( 15 20 ) in image 1. [ 15 20 :,:]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADGJJREFUeJzt3W+sZIVZx/HvT3ZZLGDKCm5WINISoiGNLuSKNSVNFalImgBJY+BFsy+I25iSQFITERPFFyZoBOILg1lkZaNIrQXCviC2WyQhTQxlwQUWtgpFSFmX3RJswDeUP48v7llzWZ/7hzv3zpnS7yeZzJkzZ/Y8Odz73Zk5M0uqCknS+/3E2ANI0iwyjpLUMI6S1DCOktQwjpLUMI6S1DCOktQwjpLUMI6S1NgwyYOTXAb8JXAC8DdVdctS25+YTXUSJ0+yS0mayJv892tVdcZy2606jklOAP4KuBR4BXg8yZ6qem6xx5zEyfxKLlntLiVpYt+sr728ku0meVl9EfBCVb1YVT8EvgJcMcGfJ0kzY5I4ngl8b8HtV4Z1kvQjb6L3HFciyQ5gB8BJfGS9dydJa2KSZ46HgLMX3D5rWPc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yZT/107fqaqOnaM/nQ4Rrcn2TTNmVbKEzLzLq6qC4HfAr6U5NNjD3S8mn9tMvbfuncA5wLbgMPArdMeIMkpwH3ADVX1xsL7xjhGzTyjHaOqereqtgFnMf8K7Remte/FHD9Tkk8Af8D8bL8MbAZ+f8QRFzVGHA8BZy+4fdawbjRVdWi4Pgo8wPwP1iw4kmQrwHB9dMxhqurI8MP+HnAnUz5OSTYyH6J7qur+YfVox6ibZ+xjNMzwA+AR4FeBjybZMNw12u/agpkuG96SqKp6C/hbZuf37X3GiOPjwHnDWbQTgauBPSPMAUCSk5OcemwZ+CxwYOlHTc0eYPuwvB14cMRZjsXnmKuY4nFKEuAu4GBV3bbgrlGO0WLzjHWMkpyR5KPD8k8ClzL/PugjwOeHzab6M7TITN9Z8JdZmH8PdFZ+395vjLNAwOXMn937LvCHY56RYv6s+VPD5dmx5gHuZf5l2NvMvzd0LfDTwMPA88A3gc0jz/N3wDPA08xHaesU57mY+ZfMTwP7h8vlYx2jJeYZ5RgBvwj827DfA8AfDes/DnwbeAH4J2DTFP+bLTbTvwzH6ADw9wxntGft4jdkJKnhCRlJahhHSWoYR0lqGEdJahhHSWoYR0lqGEdJahhHSWr8L74ad30ixg3ZAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sum up dim1 and dim2. should look like warping\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAELdJREFUeJzt3X+oZPV5x/H3U3Nddf2xbne7LEY0P8QqYbvKjdmQ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eDy6mozfQwNqelnS/6ZBYPXQPvy9/ZuXbwLBFzC4N29XwJ/2eU7UgzeNf9x9fWTruoB7mTwNOwAg9eGrgZ+F3gE+AXwMLC643r+BXgG2M4glNbPsJ6PM3jKvB3YVn1d0tU+qqmnk30EbAD+qxp3B/BX1fL3Az8CdgHfBVbM8Hc2rKb/rPbRDuBfqd7R7tuXn5CRpALfkJGkAsNRkgoMR0kqMBwlqcBwlKQCw1GSCgxHSSowHCWp4P8AxeKG2BinAhUAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(30, 40)\n",
      "the correspondence of '0,0', in warped image. [30,40,y,x]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADFxJREFUeJzt3V2oZYV5h/Hn35lxUqMlTrTDVIeaiLRIaUc5lZRISJuaWm9UCEUvwlwIE0oEhRRqU2jtRcGWqvSiWMZqHVprmkYlXkiTiRUkUNSjHcfRSdVYJQ7jTKwN2hvjx9uLswaOp+/5mPOx11aeH2z22muvPetlec4ze+11jpOqQpL0QT8z9gCSNI2MoyQ1jKMkNYyjJDWMoyQ1jKMkNYyjJDWMoyQ1jKMkNTav5cVJLgP+GtgE/F1V3bzU9mdu21Tn7txy0vt5/uCpqxtQkhZ4i/95varOWm67VccxySbgb4BLgVeBJ5I8WFXPLfaac3du4fHv7Dzpff3OL+xa7ZiS9AHfq2+9spLt1nJafTHwYlW9VFU/Bb4BXLGGP0+SpsZa4ng28KN5j18d1knSh96GX5BJsifJbJ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duxn7gztJ1X17rDJxL/XFs5UVSeO0Z8Px+i2JFsnOdNKeUFmziVVdRHwu8BXk3xu7IEWqrlzk7H/1r0dOA/YBRwFbpn0AElOA+4DbqiqN+c/N8YxauYZ7RhV1XtVtQs4h7kztF+e1L4Xs3CmJL8C/BFzs/06sA34wxFHXNQYcTwC7Jz3+Jxh3Wiq6shwfxx4gLkvrGlwLMkOgOH++JjDVNWx4Yv9feAOJnyckmxhLkT3VNX9w+rRjlE3z9jHaJjhJ8AjwG8An0iyeXhqtO+1eTNdNnwkUVX1NvD3TM/32weMEccngPOHq2inAFcDD44wBwBJPp7k9BPLwBeBQ0u/amIeBHYPy7uBb484y4n4nHAVEzxOSQLcCRyuqlvnPTXKMVpsnrGOUZKzknxiWP5Z4FLmPgd9BPjSsNlEv4YWmekH8/4yC3OfgU7L99sHjXEVCLicuat7PwT+eMwrUsxdNX96uD071jzAvcydhr3D3GdD1wKfBB4GXgC+B2wbeZ5/AJ4BDjIXpR0TnOcS5k6ZDwIHhtvlYx2jJeYZ5RgBvwr8x7DfQ8CfDOs/DTwOvAj8C7B1gv/NFpvp34ZjdAj4R4Yr2tN28zdkJKnhBRlJahhHSWoYR0lqGEdJahhHSWoYR0lqGEdJahhHSWr8H8BmdfFzgw8PAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sum up dim3 and dim4. should look like all ones\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAETtJREFUeJzt3W+sJXV9x/H3t7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xv4qcCMDr6eI2MByEX0pM++srh5tHZXyjL2Oqgw/Ab4OXAi8JSKOng5ltOfaikwXVW9JZGb+H/D3TOf59hpjlOM3gbOrT9FOAj4K3DNCDgAi4uSIOPXoZeCDwL76ew3mHuCK6vIVwFdGzHK0fI76MAOup4gI4CZgf2Z+bsVNo6yjWXnGWkcRcUZEvKW6/CbgAyy/D/p14OiJbgbdhmZk+s6Kf8yC5fdAp/J8e60xPgUCLmb5073vAX865idSLH9q/nj19a2x8gC3svwy7Bcsvzf0ceCtwP3Ad4F/A04fOc8/AE8CT7BcSlsGzPMell8yPwHsrb4uHmsd1eQZZR0BvwX8R7XcfcCfVde/HXgEeAr4Z+ANA/7OZmX692od7QP+keoT7al9+T9kJKnAD2QkqcBylKQCy1GSCixHSSqwHCWpwHKUpALLUZIKLEdJKvh//5Y3zIbBXBoAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "print(\"mask shape\", mask.shape)\n",
    "from utils.utils import pltImshow\n",
    "mask_o = mask.cpu().numpy()\n",
    "y, x = 0, 0\n",
    "height, width = 30, 40\n",
    "def plot_mask_corr(mask, y,x):\n",
    "    img = mask[0,y,x,:,:]\n",
    "    print(img.shape)\n",
    "    print(\"the correspondence of (\",y,x,\") in image 1. [\",y,x,\":,:]\")\n",
    "    pltImshow(img)\n",
    "plot_mask_corr(mask_o, 0,0)\n",
    "plot_mask_corr(mask_o, height-1,width-1)\n",
    "plot_mask_corr(mask_o, height-1,0)\n",
    "plot_mask_corr(mask_o, 0,width-1)\n",
    "plot_mask_corr(mask_o, height//2,width//2)\n",
    "# \n",
    "mask_o = mask.sum(dim=1).sum(dim=1)\n",
    "img = (mask_o).cpu().numpy()[0,:,:]\n",
    "print(\"sum up dim1 and dim2. should look like warping\")\n",
    "\n",
    "pltImshow(img)\n",
    "# \n",
    "y, x = 1, 5\n",
    "img = (mask).cpu().numpy()[0,:,:,y,x]\n",
    "print(img.shape)\n",
    "print(\"the correspondence of '0,0', in warped image. [30,40,y,x]\")\n",
    "pltImshow(img)\n",
    "\n",
    "# \n",
    "mask_o = mask.sum(dim=3).sum(dim=3)\n",
    "img = (mask_o).cpu().numpy()[0,:,:]\n",
    "print(\"sum up dim3 and dim4. should look like all ones\")\n",
    "\n",
    "pltImshow(img)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "def loadConfig(filename):\n",
    "    import yaml\n",
    "    with open(filename, 'r') as f:\n",
    "        config = yaml.load(f)\n",
    "    return config\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "config path:  configs/superpoint_coco_test.yaml\n",
      "config:  {'data': {'name': 'coco', 'dataset': 'coco', 'labels': 'magicpoint_synth20_homoAdapt100_coco/predictions', 'cache_in_memory': False, 'validation_size': 10, 'preprocessing': {'resize': [240, 320]}, 'augmentation': {'photometric': {'enable': True, 'primitives': ['random_brightness', 'random_contrast', 'additive_speckle_noise', 'additive_gaussian_noise', 'additive_shade', 'motion_blur'], 'params': {'random_brightness': {'max_abs_change': 50}, 'random_contrast': {'strength_range': [0.5, 1.5]}, 'additive_gaussian_noise': {'stddev_range': [0, 10]}, 'additive_speckle_noise': {'prob_range': [0, 0.0035]}, 'additive_shade': {'transparency_range': [-0.5, 0.5], 'kernel_size_range': [100, 150]}, 'motion_blur': {'max_kernel_size': 3}}}, 'homographic': {'enable': False}}, 'warped_pair': {'enable': True, 'params': {'translation': True, 'rotation': True, 'scaling': True, 'perspective': True, 'scaling_amplitude': 0.2, 'perspective_amplitude_x': 0.2, 'perspective_amplitude_y': 0.2, 'patch_ratio': 0.85, 'max_angle': 1.57, 'allow_artifacts': True}, 'valid_border_margin': 3}}, 'model': {'name': 'magic_point', 'batch_size': 1, 'eval_batch_size': 3, 'learning_rate': 0.0001, 'detection_threshold': 0.015, 'descriptor_dist': 7.5, 'lambda_d': 800, 'lambda_loss': 1, 'nn_thresh': 0.8, 'nms': 4}, 'retrain': True, 'reset_iter': True, 'train_iter': 170000, 'validation_interval': 2000, 'pretrained': 'logs/superpoint_coco21_4_gn/checkpoints/superPointNet_50000_checkpoint.pth.tar'}\n"
     ]
    }
   ],
   "source": [
    "# load config\n",
    "# logging.basicConfig(format='[%(asctime)s %(levelname)s] %(message)s',\n",
    "#                         datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO)\n",
    "\n",
    "\n",
    "filename = 'configs/superpoint_coco_test.yaml'\n",
    "# filename = 'configs/magicpoint_repeatability.yaml'\n",
    "config = loadConfig(filename)\n",
    "print(\"config path: \", filename)\n",
    "print(\"config: \", config)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## descriptor_loss my implementation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "## random data\n",
    "np.random.seed(seed=0)\n",
    "descriptors_np = np.random.rand(1,30,40,256).astype('float32')\n",
    "warped_descriptors_np = np.random.rand(1,30,40,256).astype('float32')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "homographies:  [[[ 0.6867 -0.4182  0.1464]\n",
      "  [ 0.3948  0.7248  0.0734]\n",
      "  [ 0.1248  0.      1.    ]]]\n"
     ]
    }
   ],
   "source": [
    "# sample homography\n",
    "def sample_homography_batches(config, batch_size=1, shape=np.array([1,1]), tf=False):\n",
    "    offset = 0\n",
    "    b = 2\n",
    "\n",
    "    if tf:\n",
    "        from utils.homographies import sample_homography as sample_homography\n",
    "#         shape = np.array([b, b])\n",
    "        mat_homographies = [sample_homography(shape,\n",
    "                                          **config['data']['augmentation']['homographic']['params']) for i in range(batch_size)]\n",
    "        \n",
    "#         mat_homographies = [scale_homography(sample_homography(shape,\n",
    "#                                           **config['data']['warped_pair']['params']), shape)\n",
    "#                                             for i in range(batch_size)]\n",
    "    else:\n",
    "        from utils.homographies import sample_homography_np as sample_homography\n",
    "        mat_homographies = [sample_homography(shape, shift=-1 + offset,\n",
    "                                          **config['data']['warped_pair']['params']) for i in range(batch_size)]\n",
    "    \n",
    "    mat_homographies = np.stack(mat_homographies, axis=0)\n",
    "    return mat_homographies\n",
    "\n",
    "# homographies = sample_homography_batches(config, shape = np.array([2,2]))\n",
    "homographies = sample_homography_batches(config, batch_size=1, shape=np.array([2,2]), tf=False)\n",
    "\n",
    "print(\"homographies: \", homographies)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "homography visualization for my inplementation\n",
      "print forward homographies\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAU0AAAD8CAYAAADzEfagAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAEkBJREFUeJzt3W+MXNddxvHv07hJoYU4CWAF25BUtVpFSE2DVRxRodJQSAKq86KKWiHFiiz5DX9aQCopvEBIvKASIjQqirCagoNK2xBaYkVVS3AjwZuE2rSkbdyQLRBsK4n7J3GhkSghP17M2Waysb1zdmd2dma+H2k09557ZufcuTvPnnPuzN1UFZKk0bxi2g2QpFliaEpSB0NTkjoYmpLUwdCUpA6GpiR1mEhoJrk+yWNJlpLcNonnkKRpyLg/p5nkAuBfgbcDJ4HPA++uqkfH+kSSNAWT6Gm+GViqqn+rqu8CHwf2TuB5JGnDbZnAz9wOnBhaPwn81PkekMSvJUmatm9U1Q+vVmkSoTmSJAeAA9N6fkla4YlRKk0iNE8BO4fWd7Syl6iqg8BBsK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gR8FXs3gojwLZ9qhObfX3kzySgaB+dGq+mQrntdrkP408I4k/wF8nMEQ/YMM/tXJ8ld1h/fpe/vbtl8MfHMjGzwGJ4GTVfVwW7+XQYjO6zH+OeDfq+rrVfW/wCcZHPd5PsZnNe3Q/Dywq52Bu5DBxPLhKbdp3drl8e4CjlfVHw9tmstrkFbV+6tqR1VdweAYfq6qfhl4EHhnq7Zyf5dfh3e2+jPVI6uqp4ATSV7fiq4DHmVOjzGDYfmeJN/ffr+X93duj/E5TXtSFbgR+Ffga8DvTrs9Y9qntzAYlj0CfLHdbmQwp3MEeBz4e+DSVj8MPkXwNeBLDM5QTn0/1rjvbwXub8uvBf4JWGLwb1IuauWvautLbftrp93uNe7r1cDRdpz/Frhkno8x8PvAV4EvA38JXDTvx/hsN78RJEkdpj08l6SZYmhKUgdDU5I6GJqS1MHQlKQOhqYkdTA0JamDoSlJHf4fiSanOkd3UG8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "print inverse homographies\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAU0AAAD8CAYAAADzEfagAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAE6JJREFUeJzt3WGsXOV95/HvrziQbrrFQLsWa7uFKFYiVCmEtbJGjapu2LRAo5gXEUpUCQtZ8ptuN2krdcnui1WlvthIVWlQK7RWaNdUaRJKk2KhKFnWQWrfQGM3WZLgUG7asrYFOE3A2RZpu5R/X8xz8XBj+865d+aemTPfjzSac55z5t7n3HPmN8/znDPnpqqQJE3mh/qugCQtEkNTkjowNCWpA0NTkjowNCWpA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H0fX+jhN4IkqYO+u+eStFAMTUnqwNCUpA4MTUnqwNCUpA4MTUnqwNCUpA4MTUnq4J8B64UmeC/L9cQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# homography visualization for my inplementation\n",
    "print(\"homography visualization for my inplementation\")\n",
    "\n",
    "\n",
    "from numpy.linalg import inv\n",
    "\n",
    "# sample homography\n",
    "batch_size = 1\n",
    "shape = np.array([2,2])\n",
    "homographies = sample_homography_batches(config, batch_size, shape=shape, tf=False)\n",
    "homographies_original = homographies.copy()\n",
    "\n",
    "# change shapes\n",
    "height, width = 240, 320\n",
    "image_shape = np.array([height, width])\n",
    "homographies = np.stack([scale_homography(H, image_shape, shift=(-1,-1)) for H in homographies])\n",
    "\n",
    "# warp points\n",
    "# from utils.utils import warp_points_np\n",
    "# corner_img = np.array([(0, 0), (height, 0), (height, width), (0, width)])\n",
    "corner_img = np.array([(0, 0), (0, height), (width, height), (width, 0)])\n",
    "points = warp_points_np(corner_img, homographies)\n",
    "\n",
    "# plot shapes\n",
    "offset = np.array([height,width])\n",
    "img = np.zeros((height + offset[0]*2, width + offset[1]*2,3), np.uint8)\n",
    "img = drawBox(corner_img, img, color=(255,0,0), offset=offset)\n",
    "for i in range(points.shape[0]):\n",
    "    img = drawBox(points[i,:,:], img, color=(0,255,0), offset=offset)\n",
    "print(\"print forward homographies\")\n",
    "plt.imshow(img)\n",
    "plt.show()\n",
    "\n",
    "#  inv_homography\n",
    "inv_homographies = np.stack([inv(H) for H in homographies])\n",
    "\n",
    "# warp points\n",
    "# from utils.utils import warp_points_np\n",
    "# corner_img = np.array([(0, 0), (height, 0), (height, width), (0, width)])\n",
    "corner_img = np.array([(0, 0), (0, height), (width, height), (width, 0)])\n",
    "points = warp_points_np(corner_img, inv_homographies)\n",
    "\n",
    "# plot shapes\n",
    "offset = np.array([height,width])\n",
    "img = np.zeros((height + offset[0]*2, width + offset[1]*2,3), np.uint8)\n",
    "img = drawBox(corner_img, img, color=(255,0,0), offset=offset)\n",
    "for i in range(points.shape[0]):\n",
    "    img = drawBox(points[i,:,:], img, color=(0,255,0), offset=offset)\n",
    "    \n",
    "print(\"print inverse homographies\")\n",
    "plt.imshow(img)\n",
    "\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "We use forward homography!\n",
      "homography:  [[ 0.7032  0.3074  0.0833]\n",
      " [-0.3063  0.7425 -0.0984]\n",
      " [ 0.2382 -0.      1.    ]]\n"
     ]
    }
   ],
   "source": [
    "# H = inv_homographies.squeeze().astype('float32')\n",
    "# print(\"We use inverse homography!\")\n",
    "H = homographies_original.squeeze().astype('float32')\n",
    "print(\"We use forward homography!\")\n",
    "print(\"homography: \", H)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {},
   "outputs": [],
   "source": [
    "def descriptor_loss(descriptors, descriptors_warped, homographies, mask_valid=None, \n",
    "                    cell_size=8, lamda_d=250, device='cpu', descriptor_dist=4, **config):\n",
    "    '''\n",
    "    Compute descriptor loss from descriptors_warped and given homographies\n",
    "\n",
    "    :param descriptors:\n",
    "        Output from descriptor head\n",
    "        tensor [batch_size, descriptors, Hc, Wc]\n",
    "    :param descriptors_warped:\n",
    "        Output from descriptor head of warped image\n",
    "        tensor [batch_size, descriptors, Hc, Wc]\n",
    "    :param homographies:\n",
    "        known homographies\n",
    "    :param cell_size:\n",
    "        8\n",
    "    :param device:\n",
    "        gpu or cpu\n",
    "    :param config:\n",
    "    :return:\n",
    "        loss, and other tensors for visualization\n",
    "    '''\n",
    "    def normPts(pts, shape):\n",
    "        \"\"\"\n",
    "        normalize pts to [-1, 1]\n",
    "        :param pts:\n",
    "            tensor (y, x)\n",
    "        :param shape:\n",
    "            numpy (y, x)\n",
    "        :return:\n",
    "        \"\"\"\n",
    "        pts = pts/shape*2 - 1\n",
    "        return pts\n",
    "\n",
    "    def denormPts(pts, shape):\n",
    "        \"\"\"\n",
    "        denormalize pts back to H, W\n",
    "        :param pts:\n",
    "            tensor (y, x)\n",
    "        :param shape:\n",
    "            numpy (y, x)\n",
    "        :return:\n",
    "        \"\"\"\n",
    "        pts = (pts+1)*shape/2\n",
    "        return pts\n",
    "    # config\n",
    "    from utils.utils import warp_points\n",
    "    lamda_d = lamda_d # 250\n",
    "    margin_pos = 1\n",
    "    margin_neg = 0.2\n",
    "    batch_size, Hc, Wc = descriptors.shape[0], descriptors.shape[2], descriptors.shape[3]\n",
    "    #####\n",
    "#     H, W = Hc.numpy().astype(int) * cell_size, Wc.numpy().astype(int) * cell_size\n",
    "    H, W = Hc * cell_size, Wc * cell_size\n",
    "    #####\n",
    "    # shape = torch.tensor(list(descriptors.shape[2:]))*torch.tensor([cell_size, cell_size]).type(torch.FloatTensor).to(device)\n",
    "    shape = torch.tensor([H, W]).type(torch.FloatTensor).to(device)\n",
    "    # compute the center pixel of every cell in the image\n",
    "    coor_cells = torch.stack(torch.meshgrid(torch.arange(Hc), torch.arange(Wc)), dim=2)\n",
    "    coor_cells = coor_cells.type(torch.FloatTensor).to(device)\n",
    "    coor_cells = coor_cells * cell_size + cell_size // 2\n",
    "    ## coord_cells is now a grid containing the coordinates of the Hc x Wc\n",
    "    ## center pixels of the 8x8 cells of the image\n",
    "\n",
    "    # coor_cells = coor_cells.view([-1, Hc, Wc, 1, 1, 2])\n",
    "    coor_cells = coor_cells.view([-1, 1, 1, Hc, Wc, 2])  # be careful of the order\n",
    "    # warped_coor_cells = warp_points(coor_cells.view([-1, 2]), homographies, device)\n",
    "    warped_coor_cells = normPts(coor_cells.view([-1, 2]), shape)\n",
    "    warped_coor_cells = torch.stack((warped_coor_cells[:,1], warped_coor_cells[:,0]), dim=1) # (y, x) to (x, y)\n",
    "    warped_coor_cells = warp_points(warped_coor_cells, homographies, device)\n",
    "\n",
    "    warped_coor_cells = torch.stack((warped_coor_cells[:, :, 1], warped_coor_cells[:, :, 0]), dim=2)  # (batch, x, y) to (batch, y, x)\n",
    "\n",
    "    shape_cell = torch.tensor([H//cell_size, W//cell_size]).type(torch.FloatTensor).to(device)\n",
    "    # warped_coor_mask = denormPts(warped_coor_cells, shape_cell)\n",
    "\n",
    "    warped_coor_cells = denormPts(warped_coor_cells, shape)\n",
    "    # warped_coor_cells = warped_coor_cells.view([-1, 1, 1, Hc, Wc, 2])\n",
    "    warped_coor_cells = warped_coor_cells.view([-1, Hc, Wc, 1, 1, 2])\n",
    "#     print(\"warped_coor_cells: \", warped_coor_cells.shape)\n",
    "    # compute the pairwise distance\n",
    "    cell_distances = coor_cells - warped_coor_cells\n",
    "    cell_distances = torch.norm(cell_distances, dim=-1)\n",
    "    ##### check\n",
    "#     print(\"descriptor_dist: \", descriptor_dist)\n",
    "    mask = cell_distances <= descriptor_dist # 0.5 # trick\n",
    "    mask = mask.type(torch.FloatTensor).to(device)\n",
    "\n",
    "    # compute the pairwise dot product between descriptors: d^t * d\n",
    "    descriptors = descriptors.transpose(1, 2).transpose(2, 3)\n",
    "    descriptors = descriptors.view((batch_size, Hc, Wc, 1, 1, -1))\n",
    "    descriptors_warped = descriptors_warped.transpose(1, 2).transpose(2, 3)\n",
    "    descriptors_warped = descriptors_warped.view((batch_size, 1, 1, Hc, Wc, -1))\n",
    "    dot_product_desc = descriptors * descriptors_warped\n",
    "    dot_product_desc = dot_product_desc.sum(dim=-1)\n",
    "    ## dot_product_desc.shape = [batch_size, Hc, Wc, Hc, Wc, desc_len]\n",
    "\n",
    "    # hinge loss\n",
    "    positive_dist = torch.max(margin_pos - dot_product_desc, torch.tensor(0.).to(device))\n",
    "    # positive_dist[positive_dist < 0] = 0\n",
    "    negative_dist = torch.max(dot_product_desc - margin_neg, torch.tensor(0.).to(device))\n",
    "    # negative_dist[negative_dist < 0] = 0\n",
    "    # sum of the dimension\n",
    "\n",
    "    if mask_valid is None:\n",
    "#         mask_valid = torch.ones_like(mask)\n",
    "        mask_valid = torch.ones(batch_size, 1, Hc, Wc)\n",
    "    mask_valid = mask_valid.view(batch_size, 1, 1, mask_valid.shape[2], mask_valid.shape[3])\n",
    "    print(\"mask_valid: \", mask_valid.shape)\n",
    "\n",
    "    loss_desc = lamda_d * mask * positive_dist + (1 - mask) * negative_dist\n",
    "    print(\"loss_desc: \", loss_desc.shape)\n",
    "    loss_desc = loss_desc * mask_valid\n",
    "    \n",
    "#         mask_valid = torch.ones_like(mask)\n",
    "    normalization = (batch_size * (mask_valid.sum()) * Hc * Wc)\n",
    "    pos_sum = (lamda_d * mask * positive_dist/normalization).sum()\n",
    "    neg_sum = ((1 - mask) * negative_dist/normalization).sum()\n",
    "    loss_desc = loss_desc.sum() / normalization\n",
    "    # loss_desc = loss_desc.sum() / (batch_size * Hc * Wc)\n",
    "    # return loss_desc, mask, mask_valid, positive_dist, negative_dist\n",
    "#     return loss_desc, mask, pos_sum, neg_sum\n",
    "    return {'loss': loss_desc, 'normalization': normalization, \n",
    "            'pos_sum': pos_sum, 'neg_sum': neg_sum, 'mask': mask}\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "mask_valid:  torch.Size([1, 1, 1, 30, 40])\n",
      "loss_desc:  torch.Size([1, 30, 40, 30, 40])\n",
      "loss :  tensor(63.6282)\n",
      "normalization :  tensor(1440000.)\n",
      "pos_sum :  tensor(0.)\n",
      "neg_sum :  tensor(63.6283)\n",
      "mask :  tensor([[[[[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          ...,\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]]],\n",
      "\n",
      "\n",
      "         [[[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          ...,\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]]],\n",
      "\n",
      "\n",
      "         [[[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          ...,\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]]],\n",
      "\n",
      "\n",
      "         ...,\n",
      "\n",
      "\n",
      "         [[[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          ...,\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]]],\n",
      "\n",
      "\n",
      "         [[[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          ...,\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]]],\n",
      "\n",
      "\n",
      "         [[[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          ...,\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]],\n",
      "\n",
      "          [[0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           ...,\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.],\n",
      "           [0., 0., 0.,  ..., 0., 0., 0.]]]]])\n"
     ]
    }
   ],
   "source": [
    "homographies = torch.tensor(H[np.newaxis,:,:])\n",
    "descriptors_torch = torch.tensor(descriptors_np.transpose([0,3,1,2]))\n",
    "warped_descriptors_torch = torch.tensor(warped_descriptors_np.transpose([0,3,1,2]))\n",
    "losses = descriptor_loss(descriptors_torch, warped_descriptors_torch, homographies, \n",
    "                         descriptor_dist=7.5, mask_valid=None)\n",
    "for e in losses:\n",
    "    print(e, ': ', losses[e])\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(30, 40)\n",
      "the correspondence of ( 0 0 ) in image 1. [ 0 0 :,:]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADDpJREFUeJzt22+IZYV5x/Hvr+66NmqJW+2yqNREpEVKu8rUpkRCWmuwvlEhFH0R9oWwoURQSKE2hda+KNhSlb4olrVal9aaplFxX0ibjRUkUIyrXXV102qsEpd1t2KD9o3xz9MXcxbG7TN/nHvnnqt8P3C555577pyHszPfveeemVQVkqQP+6mxB5CkeWQcJalhHCWpYRwlqWEcJalhHCWpYRwlqWEcJalhHCWpsWmSFye5AvhL4CTgb6rq1pW2Pzlb6hROnWSXkjSRt/mfN6rqrNW2W3cck5wE/BVwOfAa8GSSvVX1wnKvOYVT+bVctt5dStLEvlvff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0/ylkpwHXMTiO5HRj9EJ88BIxyjJSUkOAMeAfSyeof24qt4bNpn5z9qJM1XV8WP0p8MxuiPJllnOtFZekFl0aVVdDPw28LUkXxh7oBPV4rnJ2P/r3gmcD+wAjgC3zXqAJKcBDwA3VdVbS58b4xg184x2jKrq/araAZzD4hnaL85q38s5caYkvwT8AYuz/SqwFfj9EUdc1hhxPAycu+TxOcO60VTV4eH+GPAQi99Y8+Boku0Aw/2xMYepqqPDN/sHwF3M+Dgl2cxiiO6rqgeH1aMdo26esY/RMMOPgceAXwc+nWTT8NRoP2tLZrpi+Eiiquod4G+Zn5+3Dxkjjk8CFwxX0U4GrgX2jjAHAElOTXL68WXgS8DBlV81M3uBncPyTuDhEWc5Hp/jrmGGxylJgLuBQ1V1+5KnRjlGy80z1jFKclaSTw/LPw1czuLnoI8BXx42m+n30DIz/WDJf2Zh8TPQefl5+7AxrgIBV7J4de+HwB+OeUWKxavmzwy358eaB7ifxdOwd1n8bOh64GeBR4EXge8CW0ee5++A54BnWYzS9hnOcymLp8zPAgeG25VjHaMV5hnlGAG/DPz7sN+DwB8N6z8LfB94CfgnYMsM/82Wm+lfh2N0EPh7hiva83bzL2QkqeEFGUlqGEdJahhHSWoYR0lqGEdJahhHSWoYR0lqGEdJavwfoQlrq6gk+BQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(30, 40)\n",
      "the correspondence of ( 29 39 ) in image 1. [ 29 39 :,:]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi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1SnQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(30, 40)\n",
      "the correspondence of ( 29 0 ) in image 1. [ 29 0 :,:]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADDpJREFUeJzt22+IZYV5x/Hvr+66NmqJW+2yqNREpEVKu8rUpkRCWmuwvlEhFH0R9oWwoURQSKE2hda+KNhSlb4olrVal9aaplFxX0ibjRUkUIyrXXV102qsEpd1t2KD9o3xz9MXcxbG7TN/nHvnnqt8P3C555577pyHszPfveeemVQVkqQP+6mxB5CkeWQcJalhHCWpYRwlqWEcJalhHCWpYRwlqWEcJalhHCWpsWmSFye5AvhL4CTgb6rq1pW2Pzlb6hROnWSXkjSRt/mfN6rqrNW2W3cck5wE/BVwOfAa8GSSvVX1wnKvOYVT+bVctt5dStLEvlvffnUt201yWn0J8FJVvVxVPwG+CVw1wdeTpLkxSRzPBn605PFrwzpJ+tib6DPHtUiyC9gFcAqf2ujdSdJUTPLO8TBw7pLH5wzrPqSqdlfVQlUtbGbLBLuTpNmZJI5PAhck+UySk4Frgb3TGUuSxrXu0+qqei/JDcC/sPirPPdU1fNTm0ySRjTRZ45V9QjwyJRmkaS54V/ISFLDOEpSwzhKUsM4SlLDOEpSwzhKUsM4SlLDOEpSwzhKUsM4SlLDOEpSwzhKUsM4SlLDOEpSwzhKUsM4SlLDOEpSwzhKUsM4SlLDOEpSwzhKUsM4SlLDOEpSwzhKUsM4SlLDOEpSwzhKUsM4SlJj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AHAElOTXL68WXgS8DBlV81M3uBncPyTuDhEWc5Hp/jrmGGxylJgLuBQ1V1+5KnRjlGy80z1jFKclaSTw/LPw1czuLnoI8BXx42m+n30DIz/WDJf2Zh8TPQefl5+7AxrgIBV7J4de+HwB+OeUWKxavmzwy358eaB7ifxdOwd1n8bOh64GeBR4EXge8CW0ee5++A54BnWYzS9hnOcymLp8zPAgeG25VjHaMV5hnlGAG/DPz7sN+DwB8N6z8LfB94CfgnYMsM/82Wm+lfh2N0EPh7hiva83bzL2QkqeEFGUlqGEdJahhHSWoYR0lqGEdJahhHSWoYR0lqGEdJavwfoQlrq6gk+BQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(30, 40)\n",
      "the correspondence of ( 0 39 ) in image 1. [ 0 39 :,:]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADFJJREFUeJzt3W+sZIVZx/HvT3ZZLGDKCm5WINISoiFGF3LFmpKmilTkDZA0Bl40+4JkG1MSSGoi1kTxhQkagfjCYBZBNorUWiDwgthukYQ0MZQFF1jYKhQhZV12JdiAbyh/Hl/cs8llfe4f7sydM5DvJ5ncM2fO7Hly9t7vzplzJ5uqQpL0QT8x9gCSNI+MoyQ1jKMkNYyjJDWMoyQ1jKMkNYyjJDWMoyQ1jKMkNTZN8uQklwF/CZwA/E1V3bzS9idmS53EyZPsUpIm8hb/83pVnbHaduuOY5ITgL8CLgVeBZ5I8lBVPb/cc07iZH41l6x3l5I0se/UN19Z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cxhBtcleWY47Z7Zaf5SSc4BLmDxlcjox+i4eWCkY5TkhCT7gaPAXhbP0H5UVe8Om8z8Z+34marq2DH60+EY3ZZkyyxnWisvyCy6uKouBH4b+EqSz4090PFq8dxk7H91bwfOBXYAh4FbZj1AklOA+4AbqurNpY+NcYyaeUY7RlX1XlXtAM5i8QztF2a17+UcP1OSXwT+gMXZfgXYCvz+iCMua4w4HgLOXnL/rGHdaKrq0PD1KPAAi99Y8+BIku0Aw9ejYw5TVUeGb/b3gTuY8XFKspnFEN1TVfcPq0c7Rt08Yx+jYYYfAY8CvwZ8Msmm4aHRftaWzHTZ8JZEVdXbwN8yPz9vHzBGHJ8Azhuuop0IXA08NMIcACQ5Ocmpx5aBLwAHVn7WzDwE7ByWdwIPjjjLsfgccxUzPE5JAtwJHKyqW5c8NMoxWm6esY5RkjOSfHJY/kngUhbfB30U+OKw2Uy/h5aZ6ftL/jELi++BzsvP2weNcRUIuJzFq3s/AP5wzCtSLF41f3q4PTfWPMC9LJ6GvcPie0PXAj8NPAK8AHwH2DryPH8HPAs8w2KUts9wnotZPGV+Btg/3C4f6xitMM8oxwj4JeDfhv0eAP5oWP9p4HvAi8A/AVtm+He23Ez/MhyjA8DfM1zRnrebn5CRpIYXZCSpYRwlqWEcJalhHCWpYRwlqWEcJalhHCWpYRwlqfF/ZLtvPopDuvUAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(30, 40)\n",
      "the correspondence of ( 15 20 ) in image 1. [ 15 20 :,:]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMu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UsM4SlLDOEpSwzhKUuN/AaOSd389Knu3AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# visualization\n",
    "mask = losses['mask']\n",
    "mask_o = mask.cpu().numpy()\n",
    "y, x = 0, 0\n",
    "height, width = 30, 40\n",
    "plot_mask_corr(mask_o, 0,0)\n",
    "plot_mask_corr(mask_o, height-1,width-1)\n",
    "plot_mask_corr(mask_o, height-1,0)\n",
    "plot_mask_corr(mask_o, 0,width-1)\n",
    "plot_mask_corr(mask_o, height//2,width//2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sum up dim1 and dim2. should look like warping\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAFTlJREFUeJzt3X2sXWWVx/Hfgt6+AHUQqsfSYq+8JFoVa+e2OINjfGUYIkETB+QPhz+MVWOTMeMkg2hGJhkzzmTU+MdEU4QBHAaLgoqGGaWUhDAavC1DS6HOiJ2LtvbFosaKFHrpmj/ObnKpz7P25dlnn33afj/JTc/dz9n7WWf33nX3OWed9Zi7CwDwfCd1HQAAjCKSIwAkkBwBIIHkCAAJJEcASCA5AkACyREAEkiOAJBAcgSAhDlNdjazSyR9QdLJkr7s7p+J7j/X5vl8ndpkSgBo5IB+td/dX1J3v+LkaGYnS/oXSe+QtFPSpJnd5e6P5faZr1N1ob2tdEoAaGyDf/2J2dyvydPq1ZIed/cd7v6spK9KurzB8QBgZDRJjksk/WzG9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YjyeeId2uI58nMTNINkra7++dmDHVyjnLxdHWOzOwlZnZ6dXuBpHeo/zrofZLeU91tqD9DmZh+NOOPman/Guio/L49XxfvAkm6VP13934i6RNdviOl/rvmW6qvR7uKR9Jt6j8NO6T+a0PvV3/FrXsl/VjSBklndBzPVyQ9Immr+klp8RDjeaP6T5m3Snq4+rq0q3MUxNPJOZJ0gaT/rubdJulvq+3nSPqhpMclfU3SvCH+n+Vi2lido22S/k3VO9qj9sUnZAAggTdkACCB5AgACSRHAEggOQJAAskRABJIjgCQQHIEgASSIwAk/D9dT/0hZOhqGwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(30, 40)\n",
      "the correspondence of '0,0', in warped image. [30,40,y,x]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADDpJREFUeJzt22+IZYV5x/Hvr+66NmqJW+2yqNREpEVKu8rUpkRCWmuwvlEhFH0R9oWwoURQSKE2hda+KNhSlb4olrVal9aaplFxX0ibjRUkUIyrXXV102qsEpd1t2KD9o3xz9MXcxbG7TN/nHvnnqt8P3C555577pyHszPfveeemVQVkqQP+6mxB5CkeWQcJalhHCWpYRwlqWEcJalhHCWpYRwlqWEcJalhHCWpsWmSFye5AvhL4CTgb6rq1pW2Pzlb6hROnWSXkjSRt/mfN6rqrNW2W3cck5wE/BVwOfAa8GSSvVX1wnKvOYVT+bVctt5dStLEvlvffnUt201yWn0J8FJVvVxVPwG+CVw1wdeTpLkxSRzPBn605PFrwzp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Npn5z9qJM1XV8WP0p8MxuiPJllnOtFZekFl0aVVdDPw28LUkXxh7oBPV4rnJ2P/r3gmcD+wAjgC3zXqAJKcBDwA3VdVbS58b4xg184x2jKrq/araAZzD4hnaL85q38s5caYkvwT8AYuz/SqwFfj9EUdc1hhxPAycu+TxOcO60VTV4eH+GPAQi99Y8+Boku0Aw/2xMYepqqPDN/sHwF3M+Dgl2cxiiO6rqgeH1aMdo26esY/RMMOPgceAXwc+nWTT8NRoP2tLZrpi+Eiiquod4G+Zn5+3Dxkjjk8CFwxX0U4GrgX2jjAHAElOTXL68WXgS8DBlV81M3uBncPyTuDhEWc5Hp/jrmGGxylJgLuBQ1V1+5KnRjlGy80z1jFKclaSTw/LPw1czuLnoI8BXx42m+n30DIz/WDJf2Zh8TPQefl5+7AxrgIBV7J4de+HwB+OeUWKxavmzwy358eaB7ifxdOwd1n8bOh64GeBR4EXge8CW0ee5++A54BnWYzS9hnOcymLp8zPAgeG25VjHaMV5hnlGAG/DPz7sN+DwB8N6z8LfB94CfgnYMsM/82Wm+lfh2N0EPh7hiva83bzL2QkqeEFGUlqGEdJahhHSWoYR0lqGEdJahhHSWoYR0lqGEdJavwfoQlrq6gk+BQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sum up dim3 and dim4. should look like all ones\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAFFpJREFUeJzt3V+sXNV1x/Hfqus/ie0IO6auAVMHg1RcUgy6xaCClYISUYj4I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zT10W9K3JO2IbzU0myWtam6vkvRYxVgOJZ9DLtUQx8nMTNK9kna6++2TVlUZo7Z4ao2RmR1tZkc1t78k6ZvqfQ/6lKTvNHcb6jnUEtPPJv1nZup9Bzoqr7fPq3EVSNIF6l3de1XSn9W8IqXeVfMXm5+Xa8Uj6QH1PoZ9ot53Q1dJ+qqkJyX9XNI/SZpfOZ6/lbRd0kvqJaVFQ4znbPU+Mr8k6YXm54JaYxSJp8oYSfpdSf/aHHeHpD9vlp8g6VlJ45L+XtLMIT5nbTH9czNGOyT9nZor2qP2w1/IAEAAF2QAIIDkCAABJEcACCA5AkAAyREAAkiOABBAcgSAAJIjAAT8N+j7uaP8+7JVAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# \n",
    "mask_o = mask.sum(dim=1).sum(dim=1)\n",
    "img = (mask_o).cpu().numpy()[0,:,:]\n",
    "print(\"sum up dim1 and dim2. should look like warping\")\n",
    "\n",
    "pltImshow(img)\n",
    "# \n",
    "y, x = 1, 5\n",
    "img = (mask).cpu().numpy()[0,:,:,y,x]\n",
    "print(img.shape)\n",
    "print(\"the correspondence of '0,0', in warped image. [30,40,y,x]\")\n",
    "pltImshow(img)\n",
    "\n",
    "# \n",
    "mask_o = mask.sum(dim=3).sum(dim=3)\n",
    "img = (mask_o).cpu().numpy()[0,:,:]\n",
    "print(\"sum up dim3 and dim4. should look like all ones\")\n",
    "\n",
    "pltImshow(img)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## descriptor_loss tensorflow"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "descriptor loss distance:  7.5\n"
     ]
    }
   ],
   "source": [
    "def descriptor_loss(descriptors, warped_descriptors, homographies,\n",
    "                    valid_mask=None, **config):\n",
    "    from models.homographies import warp_points\n",
    "    # Compute the position of the center pixel of every cell in the image\n",
    "    (batch_size, Hc, Wc) = tf.unstack(tf.to_int32(tf.shape(descriptors)[:3]))\n",
    "    coord_cells = tf.stack(tf.meshgrid(\n",
    "        tf.range(Hc), tf.range(Wc), indexing='ij'), axis=-1)\n",
    "    coord_cells = coord_cells * config['grid_size'] + config['grid_size'] // 2  # (Hc, Wc, 2)\n",
    "    # coord_cells is now a grid containing the coordinates of the Hc x Wc\n",
    "    # center pixels of the 8x8 cells of the image\n",
    "\n",
    "    # Compute the position of the warped center pixels\n",
    "    warped_coord_cells = warp_points(tf.reshape(coord_cells, [-1, 2]), homographies)\n",
    "    # warped_coord_cells is now a list of the warped coordinates of all the center\n",
    "    # pixels of the 8x8 cells of the image, shape (N, Hc x Wc, 2)\n",
    "\n",
    "    # Compute the pairwise distances and filter the ones less than a threshold\n",
    "    # The distance is just the pairwise norm of the difference of the two grids\n",
    "    # Using shape broadcasting, cell_distances has shape (N, Hc, Wc, Hc, Wc)\n",
    "    coord_cells = tf.to_float(tf.reshape(coord_cells, [1, 1, 1, Hc, Wc, 2]))\n",
    "    warped_coord_cells = tf.reshape(warped_coord_cells,\n",
    "                                    [batch_size, Hc, Wc, 1, 1, 2])\n",
    "    cell_distances = tf.norm(coord_cells - warped_coord_cells, axis=-1)\n",
    "    margin = 0.5\n",
    "    print(\"descriptor loss distance: \", config['grid_size'] - margin)\n",
    "    s = tf.to_float(tf.less_equal(cell_distances, config['grid_size'] - margin))\n",
    "\n",
    "    # s[id_batch, h, w, h', w'] == 1 if the point of coordinates (h, w) warped by the\n",
    "    # homography is at a distance from (h', w') less than config['grid_size']\n",
    "    # and 0 otherwise\n",
    "\n",
    "    # Compute the pairwise dot product between descriptors: d^t * d'\n",
    "    descriptors = tf.reshape(descriptors, [batch_size, Hc, Wc, 1, 1, -1])\n",
    "    warped_descriptors = tf.reshape(warped_descriptors,\n",
    "                                    [batch_size, 1, 1, Hc, Wc, -1])\n",
    "    dot_product_desc = tf.reduce_sum(descriptors * warped_descriptors, -1)\n",
    "    # dot_product_desc[id_batch, h, w, h', w'] is the dot product between the\n",
    "    # descriptor at position (h, w) in the original descriptors map and the\n",
    "    # descriptor at position (h', w') in the warped image\n",
    "\n",
    "    # Compute the loss\n",
    "    positive_dist = tf.maximum(0., config['positive_margin'] - dot_product_desc)\n",
    "    negative_dist = tf.maximum(0., dot_product_desc - config['negative_margin'])\n",
    "    loss = config['lambda_d'] * s * positive_dist + (1 - s) * negative_dist\n",
    "\n",
    "    # Mask the pixels if bordering artifacts appear\n",
    "    valid_mask = tf.ones([batch_size,\n",
    "                          Hc * config['grid_size'],\n",
    "                          Wc * config['grid_size']], tf.float32)\\\n",
    "        if valid_mask is None else valid_mask\n",
    "    valid_mask = tf.to_float(valid_mask[..., tf.newaxis])  # for GPU\n",
    "    valid_mask = tf.space_to_depth(valid_mask, config['grid_size'])\n",
    "    valid_mask = tf.reduce_prod(valid_mask, axis=3)  # AND along the channel dim\n",
    "    valid_mask = tf.reshape(valid_mask, [batch_size, 1, 1, Hc, Wc])\n",
    "\n",
    "    normalization = tf.reduce_sum(valid_mask) * tf.to_float(Hc * Wc)\n",
    "    # Summaries for debugging\n",
    "    # tf.summary.scalar('nb_positive', tf.reduce_sum(valid_mask * s) / normalization)\n",
    "    # tf.summary.scalar('nb_negative', tf.reduce_sum(valid_mask * (1 - s)) / normalization)\n",
    "    tf.summary.scalar('positive_dist', tf.reduce_sum(valid_mask * config['lambda_d'] *\n",
    "                                                     s * positive_dist) / normalization)\n",
    "    tf.summary.scalar('negative_dist', tf.reduce_sum(valid_mask * (1 - s) *\n",
    "                                                     negative_dist) / normalization)\n",
    "    \n",
    "    pos_sum =  tf.reduce_sum( config['lambda_d'] * s * positive_dist / normalization )\n",
    "    neg_sum =  tf.reduce_sum( (1 - s) * negative_dist / normalization )\n",
    "    \n",
    "    loss = tf.reduce_sum(valid_mask * loss) / normalization\n",
    "    return {'loss': loss, 'normalization': normalization, \n",
    "            'pos_sum': pos_sum, 'neg_sum': neg_sum,\n",
    "            'mask': s}\n",
    "\n",
    "config.update({'grid_size': 8})\n",
    "config.update({'positive_margin': 1})\n",
    "config.update({'negative_margin': 0.2})\n",
    "config.update({'lambda_d': 800})\n",
    "\n",
    "# transform H\n",
    "def scalingHomography(H, Hc = 30, Wc = 40):\n",
    "    # Hc = 30\n",
    "    # Wc = 40\n",
    "    grid_size = 8\n",
    "    Height = Hc * grid_size\n",
    "    Width = Wc * grid_size\n",
    "    image_shape = tf.constant([Height, Width])\n",
    "    # H = np.array([[1., 1., 0.], [0., 1., 0.], [0., 0., 1.]])\n",
    "    trans = np.array([[2./Width, 0., -1], [0., 2./Height, -1], [0., 0., 1.]])\n",
    "    H_tf = np.linalg.inv(np.linalg.inv(trans) @ H @ trans)\n",
    "    H_tf = H_tf / H_tf[2, 2]\n",
    "    homography = tf.constant(H_tf.reshape(-1)[:8], tf.float32)\n",
    "    return homography\n",
    "\n",
    "descriptors = tf.convert_to_tensor(descriptors_np)\n",
    "\n",
    "warped_descriptors = tf.convert_to_tensor(warped_descriptors_np)\n",
    "\n",
    "homographies_tf = scalingHomography(H, Hc = 30, Wc = 40)\n",
    "# homographies_tf = tf.convert_to_tensor(H.flatten()[:8])\n",
    "\n",
    "losses = descriptor_loss(descriptors, warped_descriptors, homographies_tf,\n",
    "                    valid_mask=None, **config)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "loss :  63.628307\n",
      "normalization :  1440000.0\n",
      "pos_sum :  0.0\n",
      "neg_sum :  63.62829\n",
      "mask :  [[[[[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   ...\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]]\n",
      "\n",
      "\n",
      "  [[[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   ...\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]]\n",
      "\n",
      "\n",
      "  [[[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   ...\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]]\n",
      "\n",
      "\n",
      "  ...\n",
      "\n",
      "\n",
      "  [[[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   ...\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]]\n",
      "\n",
      "\n",
      "  [[[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   ...\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]]\n",
      "\n",
      "\n",
      "  [[[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   ...\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]\n",
      "\n",
      "   [[0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    ...\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]\n",
      "    [0. 0. 0. ... 0. 0. 0.]]]]]\n"
     ]
    }
   ],
   "source": [
    "w"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "mask_o:  (1, 30, 40, 30, 40)\n",
      "(30, 40)\n",
      "the correspondence of ( 0 0 ) in image 1. [ 0 0 :,:]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADDpJREFUeJzt22+IZYV5x/Hvr+66NmqJW+2yqNREpEVKu8rUpkRCWmuwvlEhFH0R9oWwoURQSKE2hda+KNhSlb4olrVal9aaplFxX0ibjRUkUIyrXXV102qsEpd1t2KD9o3xz9MXcxbG7T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wJfHuP76KPcxnjneAnwUlW9XFU/Ab4JXDXCHHOlqh4H3jxh9VXAnmF5D3D1yPOMpqqOVNXTw/LbwCHgbEY6RivMM4pa9L/Dw83DrYDfBL49rJ/199ByM30sjBHHs4EfLXn8GiN+Uw0K+E6Sp5LsGnmWpbZV1ZFh+XVg25jDDG5I8uxw2j2z0/ylkpwHXMTiO5HRj9EJ88BIxyjJSUkOAMeAfSyeof24qt4bNpn5z9qJM1XV8WP0p8MxuiPJllnOtFZekFl0aVVdDPw28LUkXxh7oBPV4rnJ2P/r3gmcD+wAjgC3zXqAJKcBDwA3VdVbS58b4xg184x2jKrq/araAZzD4hnaL85q38s5caYkvwT8AYuz/SqwFfj9EUdc1hhxPAycu+TxOcO60VTV4eH+GPAQi99Y8+Boku0Aw/2xMYepqqPDN/sHwF3M+Dgl2cxiiO6rqgeH1aMdo26esY/RMMOPgceAXwc+nWTT8NRoP2tLZrpi+Eiiquod4G+Zn5+3Dxkjjk8CFwxX0U4GrgX2jjAHAElOTXL68WXgS8DBlV81M3uBncPyTuDhEWc5Hp/jrmGGxylJgLuBQ1V1+5KnRjlGy80z1jFKclaSTw/LPw1czuLnoI8BXx42m+n30DIz/WDJf2Zh8TPQefl5+7AxrgIBV7J4de+HwB+OeUWKxavmzwy358eaB7ifxdOwd1n8bOh64GeBR4EXge8CW0ee5++A54BnWYzS9hnOcymLp8zPAgeG25VjHaMV5hnlGAG/DPz7sN+DwB8N6z8LfB94CfgnYMsM/82Wm+lfh2N0EPh7hiva83bzL2QkqeEFGUlqGEdJahhHSWoYR0lqGEdJahhHSWoYR0lqGEdJavwfoQlrq6gk+BQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(30, 40)\n",
      "the correspondence of ( 29 39 ) in image 1. [ 29 39 :,:]\n"
     ]
    },
    {
     "data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wN1l4b+ha4OeBh4DngO8Am0ee5x+Bp4GnWIjS1hnOczELp8xPAfuG2+VjHaNl5hnlGAG/Bvz7sN/9wJ8O6z8KfA94HvgXYNMM/5stNdO/DsdoP/BPDFe05+3mb8hIUsMLMpLUMI6S1DCOktQwjpLUMI6S1DCOktQwjpLUMI6S1Pg/P3V4uiW1SnQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(30, 40)\n",
      "the correspondence of ( 29 0 ) in image 1. [ 29 0 :,:]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADDpJREFUeJzt22+IZYV5x/Hvr+66NmqJW+2yqNREpEVKu8rUpkRCWmuwvlEhFH0R9oWwoURQSKE2hda+KNhSlb4olrVal9aaplFxX0ibjRUkUIyrXXV102qsEpd1t2KD9o3xz9MXcxbG7TN/nHvnnqt8P3C555577pyHszPfveeemVQVkqQP+6mxB5CkeWQcJalhHCWpYRwlqWEcJalhHCWpYRwlqWEcJalhHCWpsWmSFye5AvhL4CTgb6rq1pW2Pzlb6hROnWSXkjSRt/mfN6rqrNW2W3cck5wE/BVwOfAa8GSSvVX1wnKvOYVT+bVctt5dStLEvlvffnUt201yWn0J8FJVvVxVPwG+CVw1wdeTpLkxSRzPBn605PFrwzpJ+tib6DPHtUiyC9gFcAqf2ujdSdJUTPLO8TBw7pLH5wzrPqSqdlfVQlUtbGbLBLuTpNmZJI5PAhck+UySk4Frgb3TGUuSxrXu0+qqei/JDcC/sPirPPdU1fN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38s5caYkvwT8AYuz/SqwFfj9EUdc1hhxPAycu+TxOcO60VTV4eH+GPAQi99Y8+Boku0Aw/2xMYepqqPDN/sHwF3M+Dgl2cxiiO6rqgeH1aMdo26esY/RMMOPgceAXwc+nWTT8NRoP2tLZrpi+Eiiquod4G+Zn5+3Dxkjjk8CFwxX0U4GrgX2jjAHAElOTXL68WXgS8DBlV81M3uBncPyTuDhEWc5Hp/jrmGGxylJgLuBQ1V1+5KnRjlGy80z1jFKclaSTw/LPw1czuLnoI8BXx42m+n30DIz/WDJf2Zh8TPQefl5+7AxrgIBV7J4de+HwB+OeUWKxavmzwy358eaB7ifxdOwd1n8bOh64GeBR4EXge8CW0ee5++A54BnWYzS9hnOcymLp8zPAgeG25VjHaMV5hnlGAG/DPz7sN+DwB8N6z8LfB94CfgnYMsM/82Wm+lfh2N0EPh7hiva83bzL2QkqeEFGUlqGEdJahhHSWoYR0lqGEdJahhHSWoYR0lqGEdJavwfoQlrq6gk+BQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(30, 40)\n",
      "the correspondence of ( 0 39 ) in image 1. [ 0 39 :,:]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADFJJREFUeJzt3W+sZIVZx/HvT3ZZLGDKCm5WINISoiFGF3LFmpKmilTkDZA0Bl40+4JkG1MSSGoi1kTxhQkagfjCYBZBNorUWiDwgthukYQ0MZQFF1jYKhQhZV12JdiAbyh/Hl/cs8llfe4f7sydM5DvJ5nc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vgFcPaz/a+B352Cmu4EvjvF99GFuY7xyvAh4sapeqqofA18HrhhhjrlSVY8Bbxy3+gpgz7C8B7hy5HlGU1WHq+qpYfkt4CBwJiMdoxXmGUUt+t/h7ubhVsBvAN8c1s/6e2i5mT4SxojjmcAPl9x/lRG/qQYFfDvJk0l2jTzLUtuq6vCw/BqwbcxhBtcleWY47Z7Zaf5SSc4BLmDxlcjox+i4eWCkY5TkhCT7gaPAXhbP0H5UVe8Om8z8Z+34marq2DH60+EY3ZZkyyxnWisvyCy6uKouBH4b+EqSz4090PFq8dxk7H91bwfOBXYAh4FbZj1AklOA+4AbqurNpY+NcYyaeUY7RlX1XlXtAM5i8QztF2a17+UcP1OSXwT+gMXZfgXYCvz+iCMua4w4HgLOXnL/rGHdaKrq0PD1KPAAi99Y8+BIku0Aw9ejYw5TVUeGb/b3gTuY8XFKspnFEN1TVfcPq0c7Rt08Yx+jYYYfAY8CvwZ8Msmm4aHRftaWzHTZ8JZEVdXbwN8yPz9vHzBGHJ8Azhuuop0IXA08NMIcACQ5Ocmpx5aBLwAHVn7WzDwE7ByWdwIPjjjLsfgccxUzPE5JAtwJHKyqW5c8NMoxWm6esY5RkjOSfHJY/kngUhbfB30U+OKw2Uy/h5aZ6ftL/jELi++BzsvP2weNcRUIuJzFq3s/AP5wzCtSLF41f3q4PTfWPMC9LJ6GvcPie0PXAj8NPAK8AHwH2DryPH8HPAs8w2KUts9wnotZPGV+Btg/3C4f6xitMM8oxwj4JeDfhv0eAP5oWP9p4HvAi8A/AVtm+He23Ez/MhyjA8DfM1zRnrebn5CRpIYXZCSpYRwlqWEcJalhHCWpYRwlqWEcJalhHCWpYRwlqfF/ZLtvPopDuvUAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(30, 40)\n",
      "the correspondence of ( 15 20 ) in image 1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845hkp5s+aPz1cnhtrHuB+5l+GvcP8e0PXAz8NPAK8AHwL2DzyPH8HPAs8w3yUtk5xnkuZf8n8DLB/uFw51jFaYp5RjhHwi8C/Dfs9APzRsP7jwHeAF4F/AjZN8e9ssZn+ZThGB4C/ZzijPWsXvyEjSQ1PyEhSwzhKUsM4SlLDOEpSwzhKUsM4SlLDOEpSwzhKUuN/AaOSd389Knu3AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "print(\"mask_o: \", mask_o.shape)\n",
    "plot_mask_corr(mask_o, 0,0)\n",
    "plot_mask_corr(mask_o, height-1,width-1)\n",
    "plot_mask_corr(mask_o, height-1,0)\n",
    "plot_mask_corr(mask_o, 0,width-1)\n",
    "plot_mask_corr(mask_o, height//2,width//2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sum up dim1 and dim2. should look like warping\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAFTlJREFUeJzt3X2sXWWVx/Hfgt6+AHUQqsfSYq+8JFoVa+e2OINjfGUYIkETB+QPhz+MVWOTMeMkg2hGJhkzzmTU+MdEU4QBHAaLgoqGGaWUhDAavC1DS6HOiJ2LtvbFosaKFHrpmj/ObnKpz7P25dlnn33afj/JTc/dz9n7WWf33nX3OWed9Zi7CwDwfCd1HQAAjCKSIwAkkBwBIIHkCAAJJEcASCA5AkACyREAEkiOAJBAcgSAhDlNdjazSyR9QdLJkr7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Uz8R3erud1abOztHqXi6PkdVDL+WdJ+kP5J0upkdWQ6ls9+1GTFdUr0k4e7+jKR/1ej8vj1PF8lxUtL51btocyW9V9JdHcQhSTKzU81s4ZHbki6WtC3ea2juknR1dftqSd/qMJYjyeeId2uI58nMTNINkra7++dmDHVyjnLxdHWOzOwlZnZ6dXuBpHeo/zrofZLeU91tqD9DmZh+NOOPman/Guio/L49XxfvAkm6VP13934i6RNdviOl/rvmW6qvR7uKR9Jt6j8NO6T+a0PvV3/FrXsl/VjSBklndBzPVyQ9Immr+klp8RDjeaP6T5m3Snq4+rq0q3MUxNPJOZJ0gaT/rubdJulvq+3nSPqhpMclfU3SvCH+n+Vi2lido22S/k3VO9qj9sUnZAAggTdkACCB5AgACSRHAEggOQJAAskRABJIjgCQQHIEgASSIwAk/D9dT/0hZOhqGwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(30, 40)\n",
      "the correspondence of '0,0', in warped image. [30,40,y,x]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADDpJREFUeJzt22+IZYV5x/Hvr+66NmqJW+2yqNREpEVKu8rUpkRCWmuwvlEhFH0R9oWwoURQSKE2hda+KNhSlb4olrVal9aaplFxX0ibjRUkUIyrXXV102qsEpd1t2KD9o3xz9MXcxbG7TN/nHvnnqt8P3C555577pyHszPfveeemVQVkqQP+6mxB5CkeWQcJalhHCWpYRwlqWEcJalhHCWpYRwlqWEcJalhHCWpsWmSFye5AvhL4CTgb6r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YDfBL49rJ/199ByM30sjBHHs4EfLXn8GiN+Uw0K+E6Sp5LsGnmWpbZV1ZFh+XVg25jDDG5I8uxw2j2z0/ylkpwHXMTiO5HRj9EJ88BIxyjJSUkOAMeAfSyeof24qt4bNpn5z9qJM1XV8WP0p8MxuiPJllnOtFZekFl0aVVdDPw28LUkXxh7oBPV4rnJ2P/r3gmcD+wAjgC3zXqAJKcBDwA3VdVbS58b4xg184x2jKrq/araAZzD4hnaL85q38s5caYkvwT8AYuz/SqwFfj9EUdc1hhxPAycu+TxOcO60VTV4eH+GPAQi99Y8+Boku0Aw/2xMYepqqPDN/sHwF3M+Dgl2cxiiO6rqgeH1aMdo26esY/RMMOPgceAXwc+nWTT8NRoP2tLZrpi+Eiiquod4G+Zn5+3Dxkjjk8CFwxX0U4GrgX2jjAHAElOTXL68WXgS8DBlV81M3uBncPyTuDhEWc5Hp/jrmGGxylJgLuBQ1V1+5KnRjlGy80z1jFKclaSTw/LPw1czuLnoI8BXx42m+n30DIz/WDJf2Zh8TPQefl5+7AxrgIBV7J4de+HwB+OeUWKxavmzwy358eaB7ifxdOwd1n8bOh64GeBR4EXge8CW0ee5++A54BnWYzS9hnOcymLp8zPAgeG25VjHaMV5hnlGAG/DPz7sN+DwB8N6z8LfB94CfgnYMsM/82Wm+lfh2N0EPh7hiva83bzL2QkqeEFGUlqGEdJahhHSWoYR0lqGEdJahhHSWoYR0lqGEdJavwfoQlrq6gk+BQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sum up dim3 and dim4. should look like all ones\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUcAAAD8CAYAAADkM2ZpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0c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mS2SpObffTWDcfe9zcn+maR7NORxMrPp6iWi+939kWZxtTEKxVN7jJoY3pP0lKSzJB1lZoemQ6n2WpsU0/nNVxLu7r+StEGj83r7nBrJ8TlJJzVX0WZIulzS5gpxSJLMbLaZzT10W9K3JO2IbzU0myWtam6vkvRYxVgOJZ9DLtUQx8nMTNK9kna6++2TVlUZo7Z4ao2RmR1tZkc1t78k6ZvqfQ/6lKTvNHcb6jnUEtPPJv1nZup9Bzoqr7fPq3EVSNIF6l3de1XSn9W8IqXeVfMXm5+Xa8Uj6QH1PoZ9ot53Q1dJ+qqkJyX9XNI/SZpfOZ6/lbRd0kvqJaVFQ4znbPU+Mr8k6YXm54JaYxSJp8oYSfpdSf/aHHeHpD9vlp8g6VlJ45L+XtLMIT5nbTH9czNGOyT9nZor2qP2w1/IAEAAF2QAIIDkCAABJEcACCA5AkAAyREAAkiOABBAcgSAAJIjAAT8N+j7uaP8+7JVAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# \n",
    "mask_o = mask.sum(dim=1).sum(dim=1)\n",
    "img = (mask_o).cpu().numpy()[0,:,:]\n",
    "print(\"sum up dim1 and dim2. should look like warping\")\n",
    "\n",
    "pltImshow(img)\n",
    "# \n",
    "y, x = 1, 5\n",
    "img = (mask).cpu().numpy()[0,:,:,y,x]\n",
    "print(img.shape)\n",
    "print(\"the correspondence of '0,0', in warped image. [30,40,y,x]\")\n",
    "pltImshow(img)\n",
    "\n",
    "# \n",
    "mask_o = mask.sum(dim=3).sum(dim=3)\n",
    "img = (mask_o).cpu().numpy()[0,:,:]\n",
    "print(\"sum up dim3 and dim4. should look like all ones\")\n",
    "\n",
    "pltImshow(img)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "warped_descriptors_np = np.random.rand(1,30,40,256)\n",
    "warped_descriptors_np.dtype"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "img.min()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "py36_pytorch",
   "language": "python",
   "name": "py36_pytorch"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
